Struct wiremock::http::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<Cookie<'_>> for HeaderValue

source§

fn from(cookie: Cookie<'_>) -> 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 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) -> HeaderValueswhere 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 TryFrom<HeaderValue> for HeaderValue

§

type Error = Error

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

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

Performs the conversion.
source§

impl Eq for HeaderValue

source§

impl StructuralEq for HeaderValue

source§

impl StructuralPartialEq for HeaderValue

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
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

§

type Output = T

Should always be Self
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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more