pub enum Value {
Unsigned(u64),
Negative(i64),
ByteString(Vec<u8>),
TextString(String),
Array(Vec<Value>),
Map(Vec<(Value, Value)>),
Tag(u64, Box<Value>),
Simple(SimpleValue),
}
Expand description
Possible CBOR values.
Variants§
Unsigned(u64)
Unsigned integer value (uint).
Negative(i64)
Signed integer value (nint). Only 63 bits of information are used here.
ByteString(Vec<u8>)
Byte string (bstr).
TextString(String)
Text string (tstr).
Array(Vec<Value>)
Array/tuple of values.
Map(Vec<(Value, Value)>)
Map of key-value pairs.
Tag(u64, Box<Value>)
Tagged value.
Simple(SimpleValue)
Simple value.
Implementations§
Source§impl Value
impl Value
Sourcepub fn integer(int: i64) -> Value
pub fn integer(int: i64) -> Value
Create an appropriate CBOR integer value (uint/nint). For simplicity, this only takes i64. Construct directly for the last bit.
Sourcepub fn bool_value(b: bool) -> Value
pub fn bool_value(b: bool) -> Value
Create a CBOR boolean simple value.
Sourcepub fn type_label(&self) -> u8
pub fn type_label(&self) -> u8
Return the major type for the Value
.
Trait Implementations§
Source§impl Ord for Value
impl Ord for Value
Source§impl PartialOrd for Value
impl PartialOrd for Value
impl Eq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
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,
Source§impl<T> IntoCborValue for T
impl<T> IntoCborValue for T
Source§fn into_cbor_value(self) -> Value
fn into_cbor_value(self) -> Value
Convert
self
into a CBOR Value
, consuming it along the way.Source§impl<T> IntoCborValueOption for T
impl<T> IntoCborValueOption for T
Source§fn into_cbor_value_option(self) -> Option<Value>
fn into_cbor_value_option(self) -> Option<Value>
Convert
self
into a CBOR Option<Value>
, consuming it along the way.