Skip to main content

to_writer

Function to_writer 

pub fn to_writer<W, T>(writer: W, value: &T) -> Result<(), Error>
where W: Write, T: Serialize,
Expand description

Serialize a typed value to any std::io::Write sink.

ยงExamples

use noyalib::compat::serde_yaml as syml;
let mut buf: Vec<u8> = Vec::new();
syml::to_writer(&mut buf, &42_i32).unwrap();
assert!(!buf.is_empty());