pub struct Tagged<const N: u64, T>(/* private fields */);Expand description
Statically tag a value.
§Example
use minicbor::data::{IanaTag, Tagged};
let input = [
0xc0, 0x74, 0x32, 0x30, 0x31, 0x33, 0x2d, 0x30,
0x33, 0x2d, 0x32, 0x31, 0x54, 0x32, 0x30, 0x3a,
0x30, 0x34, 0x3a, 0x30, 0x30, 0x5a
];
let date_time: Tagged<0, &str> = minicbor::decode(&input)?;
assert_eq!(date_time.tag(), IanaTag::DateTime.tag());
assert_eq!(date_time.value(), &"2013-03-21T20:04:00Z");
Implementations§
Trait Implementations§
Source§impl<const N: u64, T> Ord for Tagged<N, T>where
T: Ord,
impl<const N: u64, T> Ord for Tagged<N, T>where
T: Ord,
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<const N: u64, T> PartialOrd for Tagged<N, T>where
T: PartialOrd,
impl<const N: u64, T> PartialOrd for Tagged<N, T>where
T: PartialOrd,
impl<const N: u64, T> Copy for Tagged<N, T>where
T: Copy,
impl<const N: u64, T> Eq for Tagged<N, T>where
T: Eq,
impl<const N: u64, T> StructuralPartialEq for Tagged<N, T>
Auto Trait Implementations§
impl<const N: u64, T> Freeze for Tagged<N, T>where
T: Freeze,
impl<const N: u64, T> RefUnwindSafe for Tagged<N, T>where
T: RefUnwindSafe,
impl<const N: u64, T> Send for Tagged<N, T>where
T: Send,
impl<const N: u64, T> Sync for Tagged<N, T>where
T: Sync,
impl<const N: u64, T> Unpin for Tagged<N, T>where
T: Unpin,
impl<const N: u64, T> UnsafeUnpin for Tagged<N, T>where
T: UnsafeUnpin,
impl<const N: u64, T> UnwindSafe for Tagged<N, T>where
T: UnwindSafe,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more