Struct asserhttp::headers::HeaderValue

source ·
pub struct HeaderValue { /* private fields */ }
Expand description

A header value.

Implementations§

source§

impl HeaderValue

source

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

Create a new HeaderValue from a Vec of ASCII bytes.

§Error

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

source

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

Converts a vector of bytes to a HeaderValue 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 HeaderValue, as the rest of the library assumes that Strings are valid ASCII.

source

pub fn as_str(&self) -> &str

Get the header value as a &str

Trait Implementations§

source§

impl AsMut<HeaderValue> for HeaderValues

source§

fn as_mut(&mut self) -> &mut HeaderValue

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsRef<HeaderValue> for HeaderValues

source§

fn as_ref(&self) -> &HeaderValue

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for HeaderValue

source§

fn clone(&self) -> HeaderValue

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 HeaderValue

source§

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

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

impl Display for HeaderValue

source§

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

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

impl From<&Mime> for HeaderValue

source§

fn from(mime: &Mime) -> HeaderValue

Converts to this type from the input type.
source§

impl From<CacheDirective> for HeaderValue

source§

fn from(directive: CacheDirective) -> HeaderValue

Converts to this type from the input type.
source§

impl From<Encoding> for HeaderValue

source§

fn from(directive: Encoding) -> HeaderValue

Converts to this type from the input type.
source§

impl From<Encoding> for HeaderValue

source§

fn from(directive: Encoding) -> HeaderValue

Converts to this type from the input type.
source§

impl From<EncodingProposal> for HeaderValue

source§

fn from(entry: EncodingProposal) -> HeaderValue

Converts to this type from the input type.
source§

impl From<EncodingProposal> for HeaderValue

source§

fn from(entry: EncodingProposal) -> HeaderValue

Converts to this type from the input type.
source§

impl From<HeaderValue> for HeaderValue

source§

fn from(value: HeaderValue) -> Self

Converts to this type from the input type.
source§

impl From<HeaderValue> for HeaderValues

source§

fn from(other: HeaderValue) -> HeaderValues

Converts to this type from the input type.
source§

impl From<HeaderValues> for HeaderValue

source§

fn from(other: HeaderValues) -> HeaderValue

Converts to this type from the input type.
source§

impl From<MediaTypeProposal> for HeaderValue

source§

fn from(entry: MediaTypeProposal) -> HeaderValue

Converts to this type from the input type.
source§

impl From<Metric> for HeaderValue

source§

fn from(entry: Metric) -> HeaderValue

Converts to this type from the input type.
source§

impl From<Mime> for HeaderValue

source§

fn from(mime: Mime) -> HeaderValue

Converts to this type from the input type.
source§

impl FromIterator<HeaderValue> for HeaderValues

source§

fn from_iter<I>(iter: I) -> HeaderValues
where I: IntoIterator<Item = HeaderValue>,

Creates a value from an iterator. Read more
source§

impl FromStr for HeaderValue

source§

fn from_str(s: &str) -> Result<HeaderValue, <HeaderValue as FromStr>::Err>

Create a new HeaderValue.

This checks it’s valid ASCII.

§

type Err = Error

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

impl Hash for HeaderValue

source§

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

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<'a> PartialEq<&String> for HeaderValue

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<'a> PartialEq<&'a str> for HeaderValue

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 PartialEq<String> for HeaderValue

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 HeaderValue

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 PartialEq for HeaderValue

source§

fn eq(&self, other: &HeaderValue) -> 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 ToHeaderValues for HeaderValue

§

type Iter = IntoIter<HeaderValue>

Returned iterator over header values which this type may correspond to.
source§

fn to_header_values( &self ) -> Result<<HeaderValue as ToHeaderValues>::Iter, Error>

Converts this object to an iterator of resolved HeaderValues.
source§

impl<'a> TryFrom<&'a str> for HeaderValue

§

type Error = Error

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

fn try_from( value: &'a str ) -> Result<HeaderValue, <HeaderValue as TryFrom<&'a str>>::Error>

Performs the conversion.
source§

impl Eq for HeaderValue

source§

impl StructuralPartialEq for HeaderValue

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where 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 T
where 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 T
where 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 T
where 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 T
where V: MultiLane<T>,

source§

fn vzip(self) -> V