CborSerializable

Trait CborSerializable 

Source
pub trait CborSerializable: AsCborValue {
    // Provided methods
    fn from_slice(slice: &[u8]) -> Result<Self> { ... }
    fn to_vec(self) -> Result<Vec<u8>> { ... }
}
Expand description

Extension trait that adds serialization/deserialization methods.

Provided Methods§

Source

fn from_slice(slice: &[u8]) -> Result<Self>

Create an object instance from serialized CBOR data in a slice. This method will fail (with CoseError::ExtraneousData) if there is additional CBOR data after the object.

Source

fn to_vec(self) -> Result<Vec<u8>>

Serialize this object to a vector, consuming it along the way.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl CborSerializable for Value

Implementors§