pub struct Tag { /* private fields */ }Expand description
Content of a tagged item, CBOR major type 6.
A tag pairs an unsigned integer, which carries the semantic meaning registered for it, with the single data item it applies to.
§Example
use cbor_next::{DataItem, Tag};
let content = Tag::new(1, 1_363_896_240);
assert_eq!(content.number(), 1);
assert_eq!(content.content(), &DataItem::from(1_363_896_240));Implementations§
Source§impl Tag
impl Tag
Sourcepub fn new(number: u64, content: impl Into<DataItem>) -> Self
pub fn new(number: u64, content: impl Into<DataItem>) -> Self
Create a tag from its number and the item it applies to.
Sourcepub fn set_number(&mut self, number: u64)
pub fn set_number(&mut self, number: u64)
Replace the number of the tag.
Sourcepub fn content_mut(&mut self) -> &mut DataItem
pub fn content_mut(&mut self) -> &mut DataItem
The item the tag applies to, mutably.
Sourcepub fn into_content(self) -> DataItem
pub fn into_content(self) -> DataItem
Take ownership of the item the tag applies to.
Trait Implementations§
impl Eq for Tag
impl StructuralPartialEq for Tag
Auto Trait Implementations§
impl Freeze for Tag
impl RefUnwindSafe for Tag
impl Send for Tag
impl Sync for Tag
impl Unpin for Tag
impl UnsafeUnpin for Tag
impl UnwindSafe for Tag
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.