[][src]Function serde_sexpr::to_writer

pub fn to_writer<T: Serialize + ?Sized, W: Write>(
    writer: W,
    value: &T
) -> Result<()>

Serialize the given data structure as an S-Expression into the writer.

Examples

let mut c = Cursor::new(Vec::new());
let value = vec!["Hello!".to_string(), "Goodbye, world!".to_string(), ")|(".to_string()];
serde_sexpr::to_writer(&mut c, &value).unwrap();
let expected: &[u8] = b"(Hello! |Goodbye,\\ world!| |\\)\\|\\(|)";
assert_eq!(c.into_inner(), expected);