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,
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.