Struct rtss::RtssWriter [−][src]
pub struct RtssWriter<W> { /* fields omitted */ }
Expand description
A writer that prefixes all lines with relative timestamps.
Implementations
Create a new RtssWriter
, with a given start time, Duration
formatter,
and delimiter separating the prefix and content.
use std::io::{self, Write};
use std::time::{Duration, Instant};
extern crate rtss;
use rtss::{RtssWriter, DurationExt};
fn main() -> io::Result<()> {
let mut writer = RtssWriter::new(io::stdout(), Duration::human_string, '|', Instant::now());
writer.write(b"Hello!\n")?;
writer.write(b"World!\n")?;
Ok(())
}
// Expected output:
// 0.2μs 0.2μs | Hello!
// 84.7μs 84.6μs | World!
Trait Implementations
Writes the contents of buf
to the underlying writer, with time annotations
for any new lines.
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
🔬 This is a nightly-only experimental API. (
can_vector
)Determines if this Write
r has an efficient write_vectored
implementation. Read more
Attempts to write an entire buffer into this writer. Read more
🔬 This is a nightly-only experimental API. (
write_all_vectored
)Attempts to write multiple buffers into this writer. Read more
Writes a formatted string into this writer, returning any error encountered. Read more