Function serde_yaml::to_writer

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

Serialize the given data structure as YAML into the IO stream.

Serialization can fail if T’s implementation of Serialize decides to return an error.

Examples found in repository?
src/ser.rs (line 708)
703
704
705
706
707
708
709
710
pub fn to_string<T>(value: &T) -> Result<String>
where
    T: ?Sized + ser::Serialize,
{
    let mut vec = Vec::with_capacity(128);
    to_writer(&mut vec, value)?;
    String::from_utf8(vec).map_err(|error| error::new(ErrorImpl::FromUtf8(error)))
}