Function serde_cbor::to_value
[−]
[src]
pub fn to_value<T>(value: T) -> Result<Value, Error> where
T: Serialize,
Convert a T
into serde_cbor::Value
which is an enum that can represent
any valid CBOR data.
extern crate serde; #[macro_use] extern crate serde_derive; extern crate serde_cbor; use std::error::Error; #[derive(Serialize)] struct User { fingerprint: String, location: String, } fn main() { let u = User { fingerprint: "0xF9BA143B95FF6D82".to_owned(), location: "Menlo Park, CA".to_owned(), }; let v = serde_cbor::to_value(u).unwrap(); }