pub enum Size {
Head,
Bytes(u64),
Items(u64),
Indef,
}
Expand description
Information about a CBOR item size.
§Usage example
use minicbor::decode::info::Size;
let val = vec![1, 2, 3, 4, 5];
let cbor = minicbor::to_vec(val)?;
let hlen = Size::head(cbor[0])?;
let size = Size::tail(&cbor[.. hlen])?;
assert_eq!(Size::Items(5), size);
Variants§
Head
The item consists only of the head.
Bytes(u64)
The item is some text or byte string with the given number of bytes.
Items(u64)
The item is an array or map with the given number of items.
Indef
The item is an indefinite value.
Implementations§
Trait Implementations§
impl Copy for Size
impl Eq for Size
impl StructuralPartialEq for Size
Auto Trait Implementations§
impl Freeze for Size
impl RefUnwindSafe for Size
impl Send for Size
impl Sync for Size
impl Unpin for Size
impl UnwindSafe for Size
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 16 bytes
Size for each variant:
Head
: 0 bytesBytes
: 8 bytesItems
: 8 bytesIndef
: 0 bytes