Add deps: log, toml

This commit is contained in:
Matthias Beyer 2016-07-16 22:51:51 +02:00
parent 98e0e5aaf5
commit f50c54b6a4
4 changed files with 5 additions and 56 deletions

View file

@ -1,16 +0,0 @@
pub mod stdout;
use libimagstore::store::FileLockEntry;
pub struct ViewInformation<'a> {
pub entry: FileLockEntry<'a>,
pub view_header: bool,
pub view_content: bool,
pub view_copy: bool,
pub keep_copy: bool,
}
pub trait Viewer {
fn view(&self, vi: ViewInformation);
}

View file

@ -1,40 +0,0 @@
use std::io::{Stdout, stdout};
use toml::encode_str;
use viewer::{ViewInformation, Viewer};
pub struct StdoutViewer {
out: Stdout,
}
impl StdoutViewer {
pub fn new() -> StdoutViewer {
StdoutViewer { out: stdout() }
}
}
impl Viewer for StdoutViewer {
fn view(&self, vi: ViewInformation) {
if vi.view_copy {
unimplemented!();
}
if vi.view_header {
debug!("Going to display header: {:?}", vi.entry.get_header().header());
println!("{}", encode_str(vi.entry.get_header().header()));
}
if vi.view_content {
println!("{}", vi.entry.get_content());
}
if vi.view_copy && !vi.keep_copy {
unimplemented!()
}
}
}

View file

@ -4,6 +4,8 @@ version = "0.2.0"
authors = ["Matthias Beyer <mail@beyermatthias.de>"]
[dependencies]
log = "0.3"
toml = "0.1.25"
[dependencies.libimagstore]
path = "../libimagstore"

View file

@ -14,6 +14,9 @@
while_true,
)]
#[macro_use] extern crate log;
extern crate toml;
extern crate libimagstore;
#[macro_use] extern crate libimagerror;