pub fn to_string<T>(items: &[T]) -> Result<String>where
T: Serialize,Expand description
Serialize items to the text of Munyo language
§Example
#[derive(serde::Serialize)]
enum Enum{
Item(usize, String, f64, Vec<Enum>)
}
fn main() -> munyo::Result<()>{
let item = Enum::Item(5, "s".to_string(), 1.1, vec![
Enum::Item(4,"t".to_string(), 3.4, vec![])
]);
let items = vec![item];
let text = munyo::to_string(&items)?;
assert_eq!(&text,
r"Item 5 s 1.1
Item 4 t 3.4
");
Ok(())
}