pub struct SimpleValue(/* private fields */);Expand description
A CBOR simple value (major type 7, values 0-23 and 32-255).
In CBOR, booleans and null are not separate types but specific simple
values: false is 20, true is 21, null is 22. The constants
FALSE, TRUE, and NULL
are provided for these. Values 24-31 are reserved by the CBOR
specification and cannot be constructed. Note that CBOR also defines
undefined (simple value 23), but CBOR::Core does not give it any
special treatment.
Implementations§
Source§impl SimpleValue
impl SimpleValue
Sourcepub const fn from_u8(value: u8) -> Result<Self>
pub const fn from_u8(value: u8) -> Result<Self>
Create a simple value from a raw number. Returns Err for
reserved values 24-31.
Trait Implementations§
Source§impl Clone for SimpleValue
impl Clone for SimpleValue
Source§fn clone(&self) -> SimpleValue
fn clone(&self) -> SimpleValue
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SimpleValue
impl Debug for SimpleValue
Source§impl Default for SimpleValue
impl Default for SimpleValue
Source§fn default() -> SimpleValue
fn default() -> SimpleValue
Returns the “default value” for a type. Read more
Source§impl From<()> for SimpleValue
impl From<()> for SimpleValue
Source§impl From<SimpleValue> for Value
impl From<SimpleValue> for Value
Source§fn from(value: SimpleValue) -> Self
fn from(value: SimpleValue) -> Self
Converts to this type from the input type.
Source§impl<'a> From<SimpleValue> for ValueKey<'a>
impl<'a> From<SimpleValue> for ValueKey<'a>
Source§fn from(value: SimpleValue) -> ValueKey<'a>
fn from(value: SimpleValue) -> ValueKey<'a>
Converts to this type from the input type.
Source§impl From<SimpleValue> for u8
impl From<SimpleValue> for u8
Source§fn from(value: SimpleValue) -> Self
fn from(value: SimpleValue) -> Self
Converts to this type from the input type.
Source§impl From<bool> for SimpleValue
impl From<bool> for SimpleValue
Source§impl Hash for SimpleValue
impl Hash for SimpleValue
Source§impl Ord for SimpleValue
impl Ord for SimpleValue
Source§fn cmp(&self, other: &SimpleValue) -> Ordering
fn cmp(&self, other: &SimpleValue) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for SimpleValue
impl PartialEq for SimpleValue
Source§impl PartialOrd for SimpleValue
impl PartialOrd for SimpleValue
Source§impl TryFrom<&Value> for SimpleValue
impl TryFrom<&Value> for SimpleValue
Source§impl TryFrom<SimpleValue> for bool
impl TryFrom<SimpleValue> for bool
Source§impl TryFrom<Value> for SimpleValue
impl TryFrom<Value> for SimpleValue
Source§impl TryFrom<u8> for SimpleValue
impl TryFrom<u8> for SimpleValue
impl Copy for SimpleValue
impl Eq for SimpleValue
impl StructuralPartialEq for SimpleValue
Auto Trait Implementations§
impl Freeze for SimpleValue
impl RefUnwindSafe for SimpleValue
impl Send for SimpleValue
impl Sync for SimpleValue
impl Unpin for SimpleValue
impl UnsafeUnpin for SimpleValue
impl UnwindSafe for SimpleValue
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> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> StrictAs for T
impl<T> StrictAs for T
Source§fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
Casts the value.
Source§impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
Source§fn strict_cast_from(src: Src) -> Dst
fn strict_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.