Struct tonic::metadata::MetadataKey [−][src]
#[repr(transparent)]pub struct MetadataKey<VE: ValueEncoding> { /* fields omitted */ }
Represents a custom metadata field name.
MetadataKey
is used as the MetadataMap
key.
Implementations
impl<VE: ValueEncoding> MetadataKey<VE>
[src]
impl<VE: ValueEncoding> MetadataKey<VE>
[src]pub fn from_bytes(src: &[u8]) -> Result<Self, InvalidMetadataKey>
[src]
Converts a slice of bytes to a MetadataKey
.
This function normalizes the input.
pub fn from_static(src: &'static str) -> Self
[src]
Converts a static string to a MetadataKey
.
This function panics when the static string is a invalid metadata key.
This function requires the static string to only contain lowercase characters, numerals and symbols, as per the HTTP/2.0 specification and header names internal representation within this library.
Examples
// Parsing a metadata key let CUSTOM_KEY: &'static str = "custom-key"; let a = AsciiMetadataKey::from_bytes(b"custom-key").unwrap(); let b = AsciiMetadataKey::from_static(CUSTOM_KEY); assert_eq!(a, b);
ⓘ
// Parsing a metadata key that contains invalid symbols(s): AsciiMetadataKey::from_static("content{}{}length"); // This line panics!
ⓘ
// Parsing a metadata key that contains invalid uppercase characters. let a = AsciiMetadataKey::from_static("foobar"); let b = AsciiMetadataKey::from_static("FOOBAR"); // This line panics!
ⓘ
// Parsing a -bin metadata key as an Ascii key. let b = AsciiMetadataKey::from_static("hello-bin"); // This line panics!
ⓘ
// Parsing a non-bin metadata key as an Binary key. let b = BinaryMetadataKey::from_static("hello"); // This line panics!
pub fn as_str(&self) -> &str
[src]
Returns a str
representation of the metadata key.
The returned string will always be lower case.
Trait Implementations
impl<VE: Clone + ValueEncoding> Clone for MetadataKey<VE>
[src]
impl<VE: Clone + ValueEncoding> Clone for MetadataKey<VE>
[src]fn clone(&self) -> MetadataKey<VE>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<VE: ValueEncoding> Debug for MetadataKey<VE>
[src]
impl<VE: ValueEncoding> Debug for MetadataKey<VE>
[src]impl<VE: ValueEncoding> Display for MetadataKey<VE>
[src]
impl<VE: ValueEncoding> Display for MetadataKey<VE>
[src]impl<VE: Eq + ValueEncoding> Eq for MetadataKey<VE>
[src]
impl<VE: Eq + ValueEncoding> Eq for MetadataKey<VE>
[src]impl<'a, VE: ValueEncoding> From<&'a MetadataKey<VE>> for MetadataKey<VE>
[src]
impl<'a, VE: ValueEncoding> From<&'a MetadataKey<VE>> for MetadataKey<VE>
[src]fn from(src: &'a MetadataKey<VE>) -> MetadataKey<VE>
[src]
impl<KeyVE: ValueEncoding> From<MetadataKey<KeyVE>> for MetadataValue<Ascii>
[src]
impl<KeyVE: ValueEncoding> From<MetadataKey<KeyVE>> for MetadataValue<Ascii>
[src]fn from(h: MetadataKey<KeyVE>) -> MetadataValue<Ascii>
[src]
impl<VE: ValueEncoding> FromStr for MetadataKey<VE>
[src]
impl<VE: ValueEncoding> FromStr for MetadataKey<VE>
[src]type Err = InvalidMetadataKey
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, InvalidMetadataKey>
[src]
impl<VE: Hash + ValueEncoding> Hash for MetadataKey<VE>
[src]
impl<VE: Hash + ValueEncoding> Hash for MetadataKey<VE>
[src]impl<'a, VE: ValueEncoding> PartialEq<&'a MetadataKey<VE>> for MetadataKey<VE>
[src]
impl<'a, VE: ValueEncoding> PartialEq<&'a MetadataKey<VE>> for MetadataKey<VE>
[src]impl<'a, VE: ValueEncoding> PartialEq<&'a str> for MetadataKey<VE>
[src]
impl<'a, VE: ValueEncoding> PartialEq<&'a str> for MetadataKey<VE>
[src]impl<VE: PartialEq + ValueEncoding> PartialEq<MetadataKey<VE>> for MetadataKey<VE>
[src]
impl<VE: PartialEq + ValueEncoding> PartialEq<MetadataKey<VE>> for MetadataKey<VE>
[src]fn eq(&self, other: &MetadataKey<VE>) -> bool
[src]
fn ne(&self, other: &MetadataKey<VE>) -> bool
[src]
impl<'a, VE: ValueEncoding> PartialEq<MetadataKey<VE>> for &'a MetadataKey<VE>
[src]
impl<'a, VE: ValueEncoding> PartialEq<MetadataKey<VE>> for &'a MetadataKey<VE>
[src]impl<VE: ValueEncoding> PartialEq<str> for MetadataKey<VE>
[src]
impl<VE: ValueEncoding> PartialEq<str> for MetadataKey<VE>
[src]fn eq(&self, other: &str) -> bool
[src]
Performs a case-insensitive comparison of the string against the header name
Examples
let content_length = AsciiMetadataKey::from_static("content-length"); assert_eq!(content_length, "content-length"); assert_eq!(content_length, "Content-Length"); assert_ne!(content_length, "content length");
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
pub fn ne(&self, other: &Rhs) -> boolimpl<VE: ValueEncoding> StructuralEq for MetadataKey<VE>
[src]
impl<VE: ValueEncoding> StructuralEq for MetadataKey<VE>
[src]impl<VE: ValueEncoding> StructuralPartialEq for MetadataKey<VE>
[src]
impl<VE: ValueEncoding> StructuralPartialEq for MetadataKey<VE>
[src]Auto Trait Implementations
impl<VE> RefUnwindSafe for MetadataKey<VE> where
VE: RefUnwindSafe,
impl<VE> RefUnwindSafe for MetadataKey<VE> where
VE: RefUnwindSafe,
impl<VE> Send for MetadataKey<VE> where
VE: Send,
impl<VE> Send for MetadataKey<VE> where
VE: Send,
impl<VE> Sync for MetadataKey<VE> where
VE: Sync,
impl<VE> Sync for MetadataKey<VE> where
VE: Sync,
impl<VE> Unpin for MetadataKey<VE> where
VE: Unpin,
impl<VE> Unpin for MetadataKey<VE> where
VE: Unpin,
impl<VE> UnwindSafe for MetadataKey<VE> where
VE: UnwindSafe,
impl<VE> UnwindSafe for MetadataKey<VE> where
VE: UnwindSafe,
Blanket Implementations
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]pub fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
[src]
Notable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
pub fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
[src]
Notable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]pub fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
[src]
Notable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
pub fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
[src]
Notable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> WithSubscriber for T
[src]
impl<T> WithSubscriber for T
[src]pub fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>
impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
[src]
Notable traits for WithDispatch<T>
impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
S: Into<Dispatch>,
pub fn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>
impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
[src]
Notable traits for WithDispatch<T>
impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;