Expand description
Have you ever implemented a nice algorithm that generically uses fmt::Write
only to find out it doesn’t work with io::Write
? Worry no more - this is the
solution!
This crate provides a simple write
function which takes your io::Write
r,
converts it to fmt::Write
r and provides it to your closure. This way, you
can easily bridge the two traits and have truly generic code.
Example
let mut out = Vec::new();
use std::fmt::Write;
fmt2io::write(&mut out, |writer| write!(writer, "Hello world!")).unwrap();
assert_eq!(out, "Hello world!".as_bytes());
Structs
A bridge between
std::io::Write
and std::fmt::Write
.Functions
Converts given
io::Write
r to fmt::Write
r