[][src]Function cborg::encode

pub fn encode<V>(v: V) -> Vec<u8> where
    Value: From<V>, 

Encode a given object into CBOR.

Examples

Basic usage:

 use std::collections::HashMap;
 let map: HashMap<u32, &str> = [
    (33, "thirty-three"),
    (44, "fourty-four"),
    (55, "fifty-five")
 ].iter().cloned().collect();
 let cbor_bytes: Vec<u8> = cborg::encode(map);