pub fn write_lossy<T, W>(writer: W, value: &T) -> Result<()>Expand description
Writes a value to a “writer”.
This function is similar to write! but does not take a format
parameter.
For more information, see the module-level documentation.
§Errors
Returns an error if writing to the writer fails.
§Examples
use std::env;
use std::ffi::OsStr;
use print_bytes::write_lossy;
let string = "foobar";
let os_string = OsStr::new(string);
let mut lossy_string = Vec::new();
write_lossy(&mut lossy_string, os_string)
.expect("failed writing to vector");
assert_eq!(string.as_bytes(), lossy_string);