pub struct HeaderName(_);
Expand description

A header name.

Implementations§

source§

impl HeaderName

source

pub fn from_bytes(bytes: Vec<u8>) -> Result<Self, Error>

Create a new HeaderName from a Vec of ASCII bytes.

Error

This function will error if the bytes is not valid ASCII.

source

pub fn from_string(s: String) -> Result<Self, Error>

Create a new HeaderName from an ASCII string.

Error

This function will error if the string is not valid ASCII.

source

pub fn as_str(&self) -> &str

Returns the header name as a &str.

source

pub unsafe fn from_bytes_unchecked(bytes: Vec<u8>) -> Self

Converts a vector of bytes to a HeaderName without checking that the string contains valid ASCII.

Safety

This function is unsafe because it does not check that the bytes passed to it are valid ASCII. If this constraint is violated, it may cause memory unsafety issues with future users of the HeaderName, as the rest of the library assumes that Strings are valid ASCII.

Trait Implementations§

source§

impl Clone for HeaderName

source§

fn clone(&self) -> HeaderName

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for HeaderName

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for HeaderName

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> From<&'a str> for HeaderName

source§

fn from(value: &'a str) -> Self

Converts to this type from the input type.
source§

impl From<&HeaderName> for HeaderName

source§

fn from(value: &HeaderName) -> HeaderName

Converts to this type from the input type.
source§

impl FromStr for HeaderName

source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Create a new HeaderName.

This checks it’s valid ASCII, and lowercases it.

§

type Err = Error

The associated error which can be returned from parsing.
source§

impl Hash for HeaderName

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Index<HeaderName> for Headers

source§

fn index(&self, name: HeaderName) -> &HeaderValues

Returns a reference to the value corresponding to the supplied name.

Panics

Panics if the name is not present in Headers.

§

type Output = HeaderValues

The returned type after indexing.
source§

impl Index<HeaderName> for Request

source§

fn index(&self, name: HeaderName) -> &HeaderValues

Returns a reference to the value corresponding to the supplied name.

Panics

Panics if the name is not present in Request.

§

type Output = HeaderValues

The returned type after indexing.
source§

impl Index<HeaderName> for Response

source§

fn index(&self, name: HeaderName) -> &HeaderValues

Returns a reference to the value corresponding to the supplied name.

Panics

Panics if the name is not present in Response.

§

type Output = HeaderValues

The returned type after indexing.
source§

impl Index<HeaderName> for Trailers

source§

fn index(&self, name: HeaderName) -> &HeaderValues

Returns a reference to the value corresponding to the supplied name.

Panics

Panics if the name is not present in Trailers.

§

type Output = HeaderValues

The returned type after indexing.
source§

impl<'a> PartialEq<&'a str> for HeaderName

source§

fn eq(&self, other: &&'a str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialEq<&String> for HeaderName

source§

fn eq(&self, other: &&String) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<HeaderName> for HeaderName

source§

fn eq(&self, other: &HeaderName) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<String> for HeaderName

source§

fn eq(&self, other: &String) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<str> for HeaderName

source§

fn eq(&self, other: &str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl TryFrom<HeaderName> for HeaderName

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(name: HeaderName) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<HeaderName> for HeaderName

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(name: HeaderName) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Eq for HeaderName

source§

impl StructuralEq for HeaderName

source§

impl StructuralPartialEq for HeaderName

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

source§

fn vzip(self) -> V