Trait dcbor::CBORTaggedDecodable
source · pub trait CBORTaggedDecodable: CBORDecodable {
const CBOR_TAG: Tag;
// Required method
fn from_untagged_cbor(cbor: &CBOR) -> Result<Box<Self>, DecodeError>;
// Provided methods
fn from_tagged_cbor(cbor: &CBOR) -> Result<Box<Self>, DecodeError> { ... }
fn from_tagged_cbor_data(data: &[u8]) -> Result<Box<Self>, DecodeError> { ... }
fn from_untagged_cbor_data(data: &[u8]) -> Result<Box<Self>, DecodeError> { ... }
}Expand description
A type that can be decoded from CBOR with a specific tag.
Typically types that implement this trait will only provide the CBOR_TAG
associated constant and implement the from_untagged_cbor function.
Required Associated Constants§
Required Methods§
sourcefn from_untagged_cbor(cbor: &CBOR) -> Result<Box<Self>, DecodeError>
fn from_untagged_cbor(cbor: &CBOR) -> Result<Box<Self>, DecodeError>
Creates an instance of this type by decoding it from untagged CBOR.
Provided Methods§
sourcefn from_tagged_cbor(cbor: &CBOR) -> Result<Box<Self>, DecodeError>
fn from_tagged_cbor(cbor: &CBOR) -> Result<Box<Self>, DecodeError>
Creates an instance of this type by decoding it from tagged CBOR.
sourcefn from_tagged_cbor_data(data: &[u8]) -> Result<Box<Self>, DecodeError>
fn from_tagged_cbor_data(data: &[u8]) -> Result<Box<Self>, DecodeError>
Creates an instance of this type by decoding it from binary encoded tagged CBOR.
sourcefn from_untagged_cbor_data(data: &[u8]) -> Result<Box<Self>, DecodeError>
fn from_untagged_cbor_data(data: &[u8]) -> Result<Box<Self>, DecodeError>
Creates an instance of this type by decoding it from binary encoded untagged CBOR.