Skip to main content

serialize

Function serialize 

Source
pub fn serialize<W>(samples: &Vec<Sample>, output: W) -> Result<(), Error>
where W: Write,
Expand description

This serializes the samples into the Chrome trace event format.

§Arguments

samples - Something that can be converted into an iterator of sample references. format - Which trace format to save the data in. There are four total formats described in the document. output - Where to write the serialized result.

§Returns

A Result<(), Error> that indicates if serialization was successful or the details of any error that occured.

§Examples

let samples = xi_trace::samples_cloned_sorted();
let mut serialized = Vec::<u8>::new();
serialize(samples.iter(), serialized);