blob: 18536da63fab1a8a0c1887a97c9bbc4ac8aa519d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
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!()
}
}
}
|