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
41
42
43
//! ## `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`
//!
//! ```rust
//! 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 implements `Flush` trait
//! flusher.flush_one(log_string);
//! }
//! }
//! }
//! ```
/// Flushes to a file
/// No-op Flush, does nothing
/// Flushes to stdout through `print!` macro
/// 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