rama::http::header

Struct HeaderValue

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

Represents an HTTP header field value.

In practice, HTTP header field values are usually valid ASCII. However, the HTTP spec allows for a header value to contain opaque bytes as well. In this case, the header field value is not able to be represented as a string.

To handle this, the HeaderValue is useable as a type and can be compared with strings and implements Debug. A to_str fn is provided that returns an Err if the header value contains non visible ascii characters.

Implementations§

§

impl HeaderValue

pub const fn from_static(src: &'static str) -> HeaderValue

Convert a static string to a HeaderValue.

This function will not perform any copying, however the string is checked to ensure that no invalid characters are present. Only visible ASCII characters (32-127) are permitted.

§Panics

This function panics if the argument contains invalid header value characters.

Until Allow panicking in constants makes its way into stable, the panic message at compile-time is going to look cryptic, but should at least point at your header value:

error: any use of this value will cause an error
  --> http/src/header/value.rs:67:17
   |
67 |                 ([] as [u8; 0])[0]; // Invalid header value
   |                 ^^^^^^^^^^^^^^^^^^
   |                 |
   |                 index out of bounds: the length is 0 but the index is 0
   |                 inside `HeaderValue::from_static` at http/src/header/value.rs:67:17
   |                 inside `INVALID_HEADER` at src/main.rs:73:33
   |
  ::: src/main.rs:73:1
   |
73 | const INVALID_HEADER: HeaderValue = HeaderValue::from_static("жsome value");
   | ----------------------------------------------------------------------------
§Examples
let val = HeaderValue::from_static("hello");
assert_eq!(val, "hello");

pub fn from_str(src: &str) -> Result<HeaderValue, InvalidHeaderValue>

Attempt to convert a string to a HeaderValue.

If the argument contains invalid header value characters, an error is returned. Only visible ASCII characters (32-127) are permitted. Use from_bytes to create a HeaderValue that includes opaque octets (128-255).

This function is intended to be replaced in the future by a TryFrom implementation once the trait is stabilized in std.

§Examples
let val = HeaderValue::from_str("hello").unwrap();
assert_eq!(val, "hello");

An invalid value

let val = HeaderValue::from_str("\n");
assert!(val.is_err());

pub fn from_name(name: HeaderName) -> HeaderValue

Converts a HeaderName into a HeaderValue

Since every valid HeaderName is a valid HeaderValue this is done infallibly.

§Examples
let val = HeaderValue::from_name(ACCEPT);
assert_eq!(val, HeaderValue::from_bytes(b"accept").unwrap());

pub fn from_bytes(src: &[u8]) -> Result<HeaderValue, InvalidHeaderValue>

Attempt to convert a byte slice to a HeaderValue.

If the argument contains invalid header value bytes, an error is returned. Only byte values between 32 and 255 (inclusive) are permitted, excluding byte 127 (DEL).

This function is intended to be replaced in the future by a TryFrom implementation once the trait is stabilized in std.

§Examples
let val = HeaderValue::from_bytes(b"hello\xfa").unwrap();
assert_eq!(val, &b"hello\xfa"[..]);

An invalid value

let val = HeaderValue::from_bytes(b"\n");
assert!(val.is_err());

pub fn from_maybe_shared<T>(src: T) -> Result<HeaderValue, InvalidHeaderValue>
where T: AsRef<[u8]> + 'static,

Attempt to convert a Bytes buffer to a HeaderValue.

This will try to prevent a copy if the type passed is the type used internally, and will copy the data if it is not.

pub unsafe fn from_maybe_shared_unchecked<T>(src: T) -> HeaderValue
where T: AsRef<[u8]> + 'static,

Convert a Bytes directly into a HeaderValue without validating.

This function does NOT validate that illegal bytes are not contained within the buffer.

§Panics

In a debug build this will panic if src is not valid UTF-8.

§Safety

src must contain valid UTF-8. In a release build it is undefined behaviour to call this with src that is not valid UTF-8.

pub fn to_str(&self) -> Result<&str, ToStrError>

Yields a &str slice if the HeaderValue only contains visible ASCII chars.

This function will perform a scan of the header value, checking all the characters.

§Examples
let val = HeaderValue::from_static("hello");
assert_eq!(val.to_str().unwrap(), "hello");

pub fn len(&self) -> usize

Returns the length of self.

This length is in bytes.

§Examples
let val = HeaderValue::from_static("hello");
assert_eq!(val.len(), 5);

pub fn is_empty(&self) -> bool

Returns true if the HeaderValue has a length of zero bytes.

§Examples
let val = HeaderValue::from_static("");
assert!(val.is_empty());

let val = HeaderValue::from_static("hello");
assert!(!val.is_empty());

pub fn as_bytes(&self) -> &[u8]

Converts a HeaderValue to a byte slice.

§Examples
let val = HeaderValue::from_static("hello");
assert_eq!(val.as_bytes(), b"hello");

pub fn set_sensitive(&mut self, val: bool)

Mark that the header value represents sensitive information.

§Examples
let mut val = HeaderValue::from_static("my secret");

val.set_sensitive(true);
assert!(val.is_sensitive());

val.set_sensitive(false);
assert!(!val.is_sensitive());

pub fn is_sensitive(&self) -> bool

Returns true if the value represents sensitive data.

Sensitive data could represent passwords or other data that should not be stored on disk or in memory. By marking header values as sensitive, components using this crate can be instructed to treat them with special care for security reasons. For example, caches can avoid storing sensitive values, and HPACK encoders used by HTTP/2.0 implementations can choose not to compress them.

Additionally, sensitive values will be masked by the Debug implementation of HeaderValue.

Note that sensitivity is not factored into equality or ordering.

§Examples
let mut val = HeaderValue::from_static("my secret");

val.set_sensitive(true);
assert!(val.is_sensitive());

val.set_sensitive(false);
assert!(!val.is_sensitive());

Trait Implementations§

§

impl AsRef<[u8]> for HeaderValue

§

fn as_ref(&self) -> &[u8]

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

impl Clone for HeaderValue

§

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
§

impl Debug for HeaderValue

§

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

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

impl<'a> From<&'a After> for HeaderValue

source§

fn from(after: &'a After) -> HeaderValue

Converts to this type from the input type.
source§

impl<'a> From<&'a EntityTag> for HeaderValue

source§

fn from(tag: &'a EntityTag) -> HeaderValue

Converts to this type from the input type.
source§

impl<'a> From<&'a EntityTagRange> for HeaderValue

source§

fn from(tag: &'a EntityTagRange) -> HeaderValue

Converts to this type from the input type.
source§

impl<'a, Sep> From<&'a FlatCsv<Sep>> for HeaderValue

source§

fn from(flat: &'a FlatCsv<Sep>) -> HeaderValue

Converts to this type from the input type.
§

impl<'a> From<&'a HeaderValue> for HeaderValue

§

fn from(t: &'a HeaderValue) -> HeaderValue

Converts to this type from the input type.
source§

impl<'a> From<&'a HeaderValueString> for HeaderValue

source§

fn from(src: &'a HeaderValueString) -> HeaderValue

Converts to this type from the input type.
source§

impl<'a> From<&'a HttpDate> for HeaderValue

source§

fn from(date: &'a HttpDate) -> HeaderValue

Converts to this type from the input type.
source§

impl<'a> From<&'a IfRange_> for HeaderValue

source§

fn from(if_range: &'a IfRange_) -> HeaderValue

Converts to this type from the input type.
source§

impl<'a> From<&'a OriginOrAny> for HeaderValue

source§

fn from(origin: &'a OriginOrAny) -> HeaderValue

Converts to this type from the input type.
source§

impl<'a> From<&'a OriginOrNull> for HeaderValue

source§

fn from(origin: &'a OriginOrNull) -> HeaderValue

Converts to this type from the input type.
source§

impl<'a> From<&'a Policy> for HeaderValue

source§

fn from(policy: &'a Policy) -> HeaderValue

Converts to this type from the input type.
source§

impl<'a> From<&'a Seconds> for HeaderValue

source§

fn from(secs: &'a Seconds) -> HeaderValue

Converts to this type from the input type.
source§

impl From<EntityTag> for HeaderValue

source§

fn from(tag: EntityTag) -> HeaderValue

Converts to this type from the input type.
§

impl From<HeaderName> for HeaderValue

§

fn from(h: HeaderName) -> HeaderValue

Converts to this type from the input type.
§

impl From<HeaderValue> for AllowOrigin

§

fn from(val: HeaderValue) -> AllowOrigin

Converts to this type from the input type.
§

impl From<HeaderValue> for RequestId

§

fn from(value: HeaderValue) -> RequestId

Converts to this type from the input type.
source§

impl From<HttpDate> for HeaderValue

source§

fn from(date: HttpDate) -> HeaderValue

Converts to this type from the input type.
§

impl From<i16> for HeaderValue

§

fn from(num: i16) -> HeaderValue

Converts to this type from the input type.
§

impl From<i32> for HeaderValue

§

fn from(num: i32) -> HeaderValue

Converts to this type from the input type.
§

impl From<i64> for HeaderValue

§

fn from(num: i64) -> HeaderValue

Converts to this type from the input type.
§

impl From<isize> for HeaderValue

§

fn from(num: isize) -> HeaderValue

Converts to this type from the input type.
§

impl From<u16> for HeaderValue

§

fn from(num: u16) -> HeaderValue

Converts to this type from the input type.
§

impl From<u32> for HeaderValue

§

fn from(num: u32) -> HeaderValue

Converts to this type from the input type.
§

impl From<u64> for HeaderValue

§

fn from(num: u64) -> HeaderValue

Converts to this type from the input type.
§

impl From<usize> for HeaderValue

§

fn from(num: usize) -> HeaderValue

Converts to this type from the input type.
§

impl FromStr for HeaderValue

§

type Err = InvalidHeaderValue

The associated error which can be returned from parsing.
§

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

Parses a string s to return a value of this type. Read more
§

impl Hash for HeaderValue

§

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
§

impl<B> MakeHeaderValue<B> for HeaderValue
where B: Send + 'static,

§

fn make_header_value( self, response: Response<B>, ) -> impl Future<Output = (Response<B>, Option<HeaderValue>)> + Send

Try to create a header value from the request or response.
§

impl<S, B> MakeHeaderValue<S, B> for HeaderValue
where S: Clone + Send + Sync + 'static, B: Send + 'static,

§

fn make_header_value( &self, ctx: Context<S>, req: Request<B>, ) -> impl Future<Output = (Context<S>, Request<B>, Option<HeaderValue>)> + Send

Try to create a header value from the request or response.
§

impl<S, ReqBody, ResBody> MakeHeaderValueFactory<S, ReqBody, ResBody> for HeaderValue
where S: Clone + Send + Sync + 'static, ReqBody: Send + 'static, ResBody: Send + 'static,

§

type Maker = HeaderValue

Maker that can be produced by this Factory.
§

fn make_header_value_maker( &self, ctx: Context<S>, req: Request<ReqBody>, ) -> impl Future<Output = (Context<S>, Request<ReqBody>, <HeaderValue as MakeHeaderValueFactory<S, ReqBody, ResBody>>::Maker)> + Send

Try to create a header value from the request or response.
§

impl Ord for HeaderValue

§

fn cmp(&self, other: &HeaderValue) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
§

impl<'a, T> PartialEq<&'a T> for HeaderValue
where HeaderValue: PartialEq<T>, T: ?Sized,

§

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

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

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

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

impl PartialEq<[u8]> for HeaderValue

§

fn eq(&self, other: &[u8]) -> bool

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

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

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

impl<'a> PartialEq<HeaderValue> for &'a HeaderValue

§

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

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

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

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

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

§

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

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

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

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

impl PartialEq<HeaderValue> for [u8]

§

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

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

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

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

impl PartialEq<HeaderValue> for String

§

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

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

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

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

impl PartialEq<HeaderValue> for str

§

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

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

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

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

impl PartialEq<String> for HeaderValue

§

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

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

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

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

impl PartialEq<str> for HeaderValue

§

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

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

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

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

impl PartialEq for HeaderValue

§

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

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

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

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

impl<'a, T> PartialOrd<&'a T> for HeaderValue
where HeaderValue: PartialOrd<T>, T: ?Sized,

§

fn partial_cmp(&self, other: &&'a T) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl PartialOrd<[u8]> for HeaderValue

§

fn partial_cmp(&self, other: &[u8]) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl<'a> PartialOrd<HeaderValue> for &'a HeaderValue

§

fn partial_cmp(&self, other: &HeaderValue) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

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

§

fn partial_cmp(&self, other: &HeaderValue) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl PartialOrd<HeaderValue> for [u8]

§

fn partial_cmp(&self, other: &HeaderValue) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl PartialOrd<HeaderValue> for String

§

fn partial_cmp(&self, other: &HeaderValue) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl PartialOrd<HeaderValue> for str

§

fn partial_cmp(&self, other: &HeaderValue) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl PartialOrd<String> for HeaderValue

§

fn partial_cmp(&self, other: &String) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl PartialOrd<str> for HeaderValue

§

fn partial_cmp(&self, other: &str) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl PartialOrd for HeaderValue

§

fn partial_cmp(&self, other: &HeaderValue) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl<'a> TryFrom<&'a [u8]> for HeaderValue

§

type Error = InvalidHeaderValue

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

fn try_from( t: &'a [u8], ) -> Result<HeaderValue, <HeaderValue as TryFrom<&'a [u8]>>::Error>

Performs the conversion.
§

impl TryFrom<&HeaderValue> for Authority

§

type Error = OpaqueError

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

fn try_from( header: &HeaderValue, ) -> Result<Authority, <Authority as TryFrom<&HeaderValue>>::Error>

Performs the conversion.
§

impl TryFrom<&HeaderValue> for DnsResolveMode

§

type Error = OpaqueError

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

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

Performs the conversion.
§

impl TryFrom<&HeaderValue> for Forwarded

§

type Error = OpaqueError

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

fn try_from( header: &HeaderValue, ) -> Result<Forwarded, <Forwarded as TryFrom<&HeaderValue>>::Error>

Performs the conversion.
§

impl TryFrom<&HeaderValue> for ForwardedElement

§

type Error = OpaqueError

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

fn try_from( header: &HeaderValue, ) -> Result<ForwardedElement, <ForwardedElement as TryFrom<&HeaderValue>>::Error>

Performs the conversion.
§

impl TryFrom<&HeaderValue> for Host

§

type Error = OpaqueError

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

fn try_from( header: &HeaderValue, ) -> Result<Host, <Host as TryFrom<&HeaderValue>>::Error>

Performs the conversion.
§

impl TryFrom<&HeaderValue> for SocketAddress

§

type Error = OpaqueError

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

fn try_from( header: &HeaderValue, ) -> Result<SocketAddress, <SocketAddress as TryFrom<&HeaderValue>>::Error>

Performs the conversion.
§

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

§

type Error = InvalidHeaderValue

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

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

Performs the conversion.
§

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

§

type Error = InvalidHeaderValue

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

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

Performs the conversion.
§

impl TryFrom<HeaderValue> for Authority

§

type Error = OpaqueError

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

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

Performs the conversion.
§

impl TryFrom<HeaderValue> for Forwarded

§

type Error = OpaqueError

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

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

Performs the conversion.
§

impl TryFrom<HeaderValue> for ForwardedElement

§

type Error = OpaqueError

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

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

Performs the conversion.
§

impl TryFrom<HeaderValue> for Host

§

type Error = OpaqueError

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

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

Performs the conversion.
§

impl TryFrom<HeaderValue> for SocketAddress

§

type Error = OpaqueError

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

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

Performs the conversion.
§

impl TryFrom<String> for HeaderValue

§

type Error = InvalidHeaderValue

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

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

Performs the conversion.
§

impl TryFrom<Vec<u8>> for HeaderValue

§

type Error = InvalidHeaderValue

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

fn try_from( vec: Vec<u8>, ) -> Result<HeaderValue, <HeaderValue as TryFrom<Vec<u8>>>::Error>

Performs the conversion.
§

impl Eq 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
§

impl<A, T> AsBits<T> for A
where A: AsRef<[T]>, T: BitStore,

§

fn as_bits<O>(&self) -> &BitSlice<T, O>
where O: BitOrder,

Views self as an immutable bit-slice region with the O ordering.
§

fn try_as_bits<O>(&self) -> Result<&BitSlice<T, O>, BitSpanError<T>>
where O: BitOrder,

Attempts to view self as an immutable bit-slice region with the O ordering. 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> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<Q, K> Equivalent<K> for Q
where 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 Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

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

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

impl<Q, K> Equivalent<K> for Q
where 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<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

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 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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

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

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

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

§

fn and<S, P, B, E>(self, other: P) -> And<T, P>
where T: Policy<S, B, E>, P: Policy<S, B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
§

fn or<S, P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<S, B, E>, P: Policy<S, B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
source§

impl<T> ToHex for T
where T: AsRef<[u8]>,

source§

fn encode_hex<U>(&self) -> U
where U: FromIterator<char>,

Encode the hex strict representing self into the result. Lower case letters are used (e.g. f9b4ca)
source§

fn encode_hex_upper<U>(&self) -> U
where U: FromIterator<char>,

Encode the hex strict representing self into the result. Upper case letters are used (e.g. F9B4CA)
source§

impl<T> ToOwned for T
where T: Clone,

source§

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
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
source§

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

source§

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>,

source§

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 T
where 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
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T