#[repr(transparent)]pub struct Tagged<T: ?Sized, const N: u64>(pub T);Expand description
Statically tag a value.
§Example
use tinycbor::{tag::{Tagged, IanaTag}, Decode, Decoder};
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<&str, {IanaTag::DateTime as u64}> = Decode::decode(&mut Decoder(&input))?;
assert_eq!(date_time.0, "2013-03-21T20:04:00Z");Tuple Fields§
§0: TImplementations§
Trait Implementations§
Source§impl<T: Ord + ?Sized, const N: u64> Ord for Tagged<T, N>
impl<T: Ord + ?Sized, const N: u64> Ord for Tagged<T, N>
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<T: PartialOrd + ?Sized, const N: u64> PartialOrd for Tagged<T, N>
impl<T: PartialOrd + ?Sized, const N: u64> PartialOrd for Tagged<T, N>
impl<T: Copy + ?Sized, const N: u64> Copy for Tagged<T, N>
impl<T: Eq + ?Sized, const N: u64> Eq for Tagged<T, N>
impl<T: ?Sized, const N: u64> StructuralPartialEq for Tagged<T, N>
Auto Trait Implementations§
impl<T, const N: u64> Freeze for Tagged<T, N>
impl<T, const N: u64> RefUnwindSafe for Tagged<T, N>where
T: RefUnwindSafe + ?Sized,
impl<T, const N: u64> Send for Tagged<T, N>
impl<T, const N: u64> Sync for Tagged<T, N>
impl<T, const N: u64> Unpin for Tagged<T, N>
impl<T, const N: u64> UnwindSafe for Tagged<T, N>where
T: UnwindSafe + ?Sized,
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