Struct tonic::metadata::MetadataKey [−][src]
Represents a custom metadata field name.
MetadataKey
is used as the MetadataMap
key.
Implementations
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: ValueEncoding> AsRef<[u8]> for MetadataKey<VE>
[src]
impl<VE: ValueEncoding> AsRef<str> for MetadataKey<VE>
[src]
impl<VE: ValueEncoding> Borrow<str> 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> Display 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]
fn from(src: &'a MetadataKey<VE>) -> MetadataKey<VE>
[src]
impl<KeyVE: ValueEncoding> From<MetadataKey<KeyVE>> for MetadataValue<Ascii>
[src]
fn from(h: MetadataKey<KeyVE>) -> MetadataValue<Ascii>
[src]
impl<VE: ValueEncoding> From<MetadataKey<VE>> for Bytes
[src]
fn from(name: MetadataKey<VE>) -> Bytes
[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]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<'a, VE: ValueEncoding> PartialEq<&'a MetadataKey<VE>> for MetadataKey<VE>
[src]
fn eq(&self, other: &&'a MetadataKey<VE>) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, VE: ValueEncoding> PartialEq<&'a str> for MetadataKey<VE>
[src]
fn eq(&self, other: &&'a str) -> bool
[src]
Performs a case-insensitive comparison of the string against the header name
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[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]
fn eq(&self, other: &MetadataKey<VE>) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<VE: ValueEncoding> PartialEq<MetadataKey<VE>> for str
[src]
fn eq(&self, other: &MetadataKey<VE>) -> 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]
impl<'a, VE: ValueEncoding> PartialEq<MetadataKey<VE>> for &'a str
[src]
fn eq(&self, other: &MetadataKey<VE>) -> bool
[src]
Performs a case-insensitive comparison of the string against the header name
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[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]
impl<VE: ValueEncoding> StructuralEq for MetadataKey<VE>
[src]
impl<VE: ValueEncoding> StructuralPartialEq for MetadataKey<VE>
[src]
Auto Trait Implementations
impl<VE> RefUnwindSafe for MetadataKey<VE> where
VE: RefUnwindSafe,
VE: RefUnwindSafe,
impl<VE> Send for MetadataKey<VE> where
VE: Send,
VE: Send,
impl<VE> Sync for MetadataKey<VE> where
VE: Sync,
VE: Sync,
impl<VE> Unpin for MetadataKey<VE> where
VE: Unpin,
VE: Unpin,
impl<VE> UnwindSafe for MetadataKey<VE> where
VE: UnwindSafe,
VE: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut Tⓘ
[src]
impl<T> CallHasher for T where
T: Hash,
[src]
T: Hash,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> 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]
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, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
[src]
pub const ALIGN: usize
[src]
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
[src]
pub unsafe fn deref<'a>(ptr: usize) -> &'a Tⓘ
[src]
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut Tⓘ
[src]
pub unsafe fn drop(ptr: usize)
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,
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;