Function tycho::marshall [−][src]
pub fn marshall<W: Write, E: Into<Element>>(
writer: &mut W,
element: E
) -> TychoStatus
Marshall an element to a byte buffer or writable object.
Example
use tycho::{Element::Value, Value::Boolean, marshall}; use std::io::BufWriter; // Create a boolean value. let data = Value(Boolean(true)); // Create a buffer for result. let mut buffer = BufWriter::new(Vec::new()); // Write boolean value to buffer. marshall(&mut buffer, data).unwrap(); assert_eq!(buffer.buffer(), vec![1, 1, 1]);