Skip to content

krampenschiesser/cbor_enhanced

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Cbor enhanced library

Actions Status Crate API

Inspired by cbor_event but making use of lifetimes to support zero copy deserialization. In addition several iana tags are supported but need to be activated via feature flags.

Supported tags

Tag Description Implementation notes
64-82 Typed arrays Either direct transmution for the brave or safe parsing for the cautious
80, 81, 82, 85, 86 Typed float arrays Either direct transmution for the brave or safe parsing for the cautious, f16 is only supported in big-endian format
260, 261 Network address Direct de/serialization of network address
0, 1, 1001 DateTime Directly de/serialize chrono date time types with defined precision
2, 3 BigInt, BigUint Directly de/serialize num_bigint BigInt, BigUint
37 Uuid Directly de/serialize uuid using uuid crate
35 Regex Directly de/serialize regex using regex crate
36 Mime type Directly de/serialize mime types using mime crate
103 Geographic Coordinate Directly de/serialize geographic coordinates

Limits

  • Infinite strings and bytes are not supported since they require allocation
  • f16 LE typed array not supported

Features

  • Zero-Copy deserialization
  • Support for various iana tags
  • custom derive macro for serializing structs

Derive macro

Deriving cbor_protocol enables you to serialize/deserialize a struct into a Map<uint,Value> Where the keys for the map are the property id's.

#[derive(cbor_protocol, Clone, Eq, PartialEq, Debug)]
#[reserved(5, 6, 7)]
struct BlaStruct {
    #[id(1)]
    #[default("none")]
    name: String,
    #[id(2)]
    value: i32,
}

License

MIT and Apache

About

Rust Cbor De-/Serializer

Resources

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE.txt
Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages