Flush
trait
Simple trait that allows an underlying implementation of Flush to
perform some type of IO operation, i.e. writing to file, writing to
stdout, etc
Example usage of Flush
use quicklog_flush::Flush;
# use quicklog_flush::stdout_flusher::StdoutFlusher;
# use std::collections::VecDeque;
# fn serialize_into_string(item: String) -> String { item }
# struct Quicklog;
impl Quicklog {
fn flush_logger(&mut self) {
# let mut flusher = StdoutFlusher::new();
# let mut queue = VecDeque::new();
# queue.push_back(String::from("Hello, world!"));
while let Some(item) = queue.pop_front() {
let log_string = serialize_into_string(item);
flusher.flush_one(log_string);
}
}
}