Crate cbordata

Crate cbordata 

Source
Expand description

Module implement simple and easy CBOR serialization.

Why use custom cbor implementation while there are off-the-self solutions ?

Because CBOR specification itself is open-ended, and custom implementation means, we can mold it to the needs of distributed apps. This implementation is also tuned for big-data and document databases.

Use cbordata-derive package for procedural-macro Cborize, can be used on any struct or enum to implement IntoCbor and FromCbor trait for the derived struct or enum. Note that Cborize expects an associated constant ID. Refer to get_cborize_id for details.

§Features

  • arbitrary feature must be enabled, for Cbor and Key types to implement the arbitrary::Arbitrary trait.

Macros§

err_at
Short form to compose Error values.

Enums§

Cbor
Cbor type enumerated over its major variants.
Error
Error variants that can be returned by this package’s API.
Info
5-bit value for additional info. Refer to Cbor spec for details.
Key
Possible types that can be used as a key in cbor-map.
SimpleValue
Major type 7, simple-value. Refer to Cbor spec for details.
Tag
Major type 6, Tag values. Refer to Cbor spec for details.

Constants§

RECURSION_LIMIT
Recursion limit for nested Cbor objects.

Traits§

FromCbor
Convert from Cbor, the cbor value is typically obtained by decoding it from bytes.
IntoCbor
Convert rust-native value to Cbor, which can then be encoded into bytes using Cbor.

Functions§

get_cborize_id
Get unique ID associated with user-defined type.
pretty_print
Return pretty formated string representing val.

Type Aliases§

Result
Result type, for jsondata functions and methods, that require a success or failure variant.