Struct clog::fmt::JsonWriter [] [src]

pub struct JsonWriter<'a>(_);

Wraps a std::io::Write object to write clog output in a JSON format

Example

let clog = Clog::new().unwrap_or_else(|e| {
    e.exit();
});

// Get the commits we're interested in...
let sm = SectionMap::from_commits(clog.get_commits());

// Create a file to hold our results, which the JsonWriter will wrap (note, .unwrap() is only
// used to keep the example short and concise)
let mut file = File::create("my_changelog.json").ok().unwrap();

// Create the JSON Writer
let mut writer = JsonWriter::new(&mut file);

// Use the JsonWriter to write the changelog
clog.write_changelog_with(&mut writer).unwrap_or_else(|e| {
    e.exit();
});

Methods

impl<'a> JsonWriter<'a>
[src]

fn new<T: Write>(writer: &'a mut T) -> JsonWriter<'a>

Creates a new instance of the JsonWriter struct using a std::io::Write object.

Example

let clog = Clog::new().unwrap_or_else(|e| {
    e.exit();
});

// Create a JsonWriter to wrap stdout
let out = stdout();
let mut out_buf = BufWriter::new(out.lock());
let mut writer = JsonWriter::new(&mut out_buf);

Trait Implementations

impl<'a> FormatWriter for JsonWriter<'a>
[src]

fn write_changelog(&mut self, options: &Clog, sm: &SectionMap) -> WriterResult

Writes a changelog from a given clog::SectionMap which can be thought of as an "AST" of sorts Read more