[go: up one dir, main page]

Enum cbor::Cbor [] [src]

pub enum Cbor {
    Break,
    Undefined,
    Null,
    Bool(bool),
    Unsigned(CborUnsigned),
    Signed(CborSigned),
    Float(CborFloat),
    Bytes(CborBytes),
    Unicode(String),
    Array(Vec<Cbor>),
    Map(HashMap<StringCbor>),
    Tag(CborTag),
}

CBOR abstract syntax.

This type can represent any data item described in the CBOR specification with some restrictions. Namely, CBOR maps are limited to Unicode string keys.

Note that this representation distinguishes the size of an encoded number.

Variants

Break

A code used to signify the end of an indefinite length data item.

Undefined

An undefined data item (major type 7, value 23).

Null

A null data item (major type 7, value 22).

Bool(bool)

A boolean data item (major type 7, values 20 or 21).

Unsigned(CborUnsigned)

An unsigned integer (major type 0).

Signed(CborSigned)

A negative integer (major type 1).

Float(CborFloat)

An IEEE 754 floating point number (major type 7).

Bytes(CborBytes)

A byte string (major type 2).

Unicode(String)

A Unicode string (major type 3).

Array(Vec<Cbor>)

An array (major type 4).

Map(HashMap<StringCbor>)

A map (major type 5).

Tag(CborTag)

A tag (major type 6).

Methods

impl Cbor
[src]

fn decode<D: Decodable>(self) -> CborResult<D>

Decode a single CBOR value.

fn tag(&self) -> Option<u64>

If this is a CBOR tag, return the tag number.

Trait Implementations

impl ToJson for Cbor
[src]

fn to_json(&self) -> Json

Converts the value of self to an instance of JSON

impl PartialEq for Cbor
[src]

fn eq(&self, __arg_0: &Cbor) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &Cbor) -> bool

This method tests for !=.

impl Debug for Cbor
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Clone for Cbor
[src]

fn clone(&self) -> Cbor

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl Encodable for Cbor
[src]

fn encode<E: RustcEncoder>(&self, e: &mut E) -> Result<(), E::Error>