pub struct MetadataEntry<'a> {
pub key: Cow<'a, str>,
pub value: MetadataValue<'a>,
pub flags: MetadataFlags,
}Expand description
A single metadata entry with a key, value, and flags.
Uses Cow for the key so entries can be borrowed (from wire data) or owned.
Fields§
§key: Cow<'a, str>§value: MetadataValue<'a>§flags: MetadataFlagsImplementations§
Source§impl<'a> MetadataEntry<'a>
impl<'a> MetadataEntry<'a>
Sourcepub fn str(key: impl Into<Cow<'a, str>>, value: impl Into<Cow<'a, str>>) -> Self
pub fn str(key: impl Into<Cow<'a, str>>, value: impl Into<Cow<'a, str>>) -> Self
Create a string metadata entry with no flags.
Sourcepub fn u64(key: impl Into<Cow<'a, str>>, value: u64) -> Self
pub fn u64(key: impl Into<Cow<'a, str>>, value: u64) -> Self
Create a u64 metadata entry with no flags.
Sourcepub fn bytes(
key: impl Into<Cow<'a, str>>,
value: impl Into<Cow<'a, [u8]>>,
) -> Self
pub fn bytes( key: impl Into<Cow<'a, str>>, value: impl Into<Cow<'a, [u8]>>, ) -> Self
Create a bytes metadata entry with no flags.
Sourcepub fn with_flags(self, flags: MetadataFlags) -> Self
pub fn with_flags(self, flags: MetadataFlags) -> Self
Set flags on this entry.
Sourcepub fn into_owned(self) -> MetadataEntry<'static>
pub fn into_owned(self) -> MetadataEntry<'static>
Convert to a 'static lifetime by cloning any borrowed data.
Trait Implementations§
Source§impl<'a> Clone for MetadataEntry<'a>
impl<'a> Clone for MetadataEntry<'a>
Source§fn clone(&self) -> MetadataEntry<'a>
fn clone(&self) -> MetadataEntry<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for MetadataEntry<'a>
impl<'a> Debug for MetadataEntry<'a>
Source§impl<'a, 'ʄ> Facet<'ʄ> for MetadataEntry<'a>where
'a: 'ʄ,
'ʄ: 'a,
impl<'a, 'ʄ> Facet<'ʄ> for MetadataEntry<'a>where
'a: 'ʄ,
'ʄ: 'a,
Source§impl<'a> PartialEq for MetadataEntry<'a>
impl<'a> PartialEq for MetadataEntry<'a>
impl<'a> Eq for MetadataEntry<'a>
impl<'a> StructuralPartialEq for MetadataEntry<'a>
Auto Trait Implementations§
impl<'a> Freeze for MetadataEntry<'a>
impl<'a> RefUnwindSafe for MetadataEntry<'a>
impl<'a> Send for MetadataEntry<'a>
impl<'a> Sync for MetadataEntry<'a>
impl<'a> Unpin for MetadataEntry<'a>
impl<'a> UnsafeUnpin for MetadataEntry<'a>
impl<'a> UnwindSafe for MetadataEntry<'a>
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<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.