Skip to main content

to_string_multi

Function to_string_multi 

Source
pub fn to_string_multi<T: Serialize>(values: &[T]) -> Result<String>
Expand description

Serialize an iterable of values as a multi-document YAML string with --- document-start markers between each.

§Errors

All variants documented on to_string; the first failing document short-circuits and returns its error — earlier documents are not emitted.

§Examples

let docs = vec![1, 2, 3];
let yaml = noyalib::to_string_multi(&docs).unwrap();
assert!(yaml.contains("---"));