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> Ord for Tagged<N, T>
impl<const N: u64, T: Ord> Ord for Tagged<N, T>
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> PartialOrd for Tagged<N, T>
impl<const N: u64, T: PartialOrd> PartialOrd for Tagged<N, T>
impl<const N: u64, T: Copy> Copy for Tagged<N, T>
impl<const N: u64, T: Eq> Eq for Tagged<N, T>
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> 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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)