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§

source

const CBOR_TAG: Tag

The CBOR tag associated with this type.

Required Methods§

source

fn from_untagged_cbor(cbor: &CBOR) -> Result<Box<Self>, DecodeError>

Creates an instance of this type by decoding it from untagged CBOR.

Provided Methods§

source

fn from_tagged_cbor(cbor: &CBOR) -> Result<Box<Self>, DecodeError>

Creates an instance of this type by decoding it from tagged CBOR.

source

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.

source

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.

Implementors§