Function tycho::unmarshall[][src]

pub fn unmarshall<R: Read>(reader: &mut R) -> TychoResult<Element>

Unmarshall an element from a readable object.

Example

use std::io::{BufReader, Cursor};
use tycho::unmarshall;
use tycho::Value::Number;
use tycho::Number::Unsigned8;
use tycho::Element::Value;

// Create a cursor with example bytes
let mut bytes = Cursor::new(vec![1, 4, 1, 10]);

// Unmarshall readable object.
let data = unmarshall(&mut bytes).unwrap();

assert_eq!(data, Value(Number(Unsigned8(10))));