[][src]Function serde_sexpr::to_vec

pub fn to_vec<T: Serialize + ?Sized>(value: &T) -> Result<Vec<u8>>

Serialize the given data structure as an S-Expression in a byte vector.

Examples

let value = vec!["Hello!".to_string(), "Goodbye, world!".to_string(), ")|(".to_string()];
assert_eq!(
    serde_sexpr::to_vec(&value).unwrap(),
    "(Hello! |Goodbye,\\ world!| |\\)\\|\\(|)".as_bytes(),
);