pub enum Key {
Bool(bool),
N64(i64),
U64(u64),
F32(f32),
F64(f64),
Bytes(Vec<u8>),
Text(String),
}Expand description
Possible types that can be used as a key in cbor-map.
Variants§
Implementations§
Source§impl Key
impl Key
Sourcepub fn to_type_order(&self) -> usize
pub fn to_type_order(&self) -> usize
As per cbor spec, map’s key can be a heterogeneous collection of types. That is, some of the keys can be Boolean, other can be numbers etc ..
This function defines the ordering for supported key types. As,
- Key::Bool, sort before every other keys.
- Key::N64, sort after boolean type.
- Key::U64, sort after negative integers.
- Key::F32, sort after positive integers.
- Key::F64, sort after 32-bit floating point numbers.
- Key::Bytes, sort after 64-bit floating point numbers.
- Key::Text, sort after bytes.
Trait Implementations§
Source§impl Arbitrary for Key
impl Arbitrary for Key
Source§fn arbitrary(u: &mut Unstructured<'_>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'_>) -> Result<Self>
Generate an arbitrary value of
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'_>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'_>) -> Result<Self, Error>
Generate an arbitrary value of
Self from the entirety of the given unstructured data. Read moreSource§impl Ord for Key
impl Ord for Key
Source§impl PartialOrd for Key
impl PartialOrd for Key
impl Eq for Key
Auto Trait Implementations§
impl Freeze for Key
impl RefUnwindSafe for Key
impl Send for Key
impl Sync for Key
impl Unpin for Key
impl UnwindSafe for Key
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more