pub struct HeaderValue { /* private fields */ }Expand description
HeaderValue type
Note: Unlike HeaderValue in http, this only supports UTF-8 header values
Implementations§
Source§impl HeaderValue
impl HeaderValue
Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Returns the string representation of this header value
§Panics
If the value is not valid UTF-8. A HeaderValue stored in a Headers may be of any
encoding, so prefer try_as_str or
as_bytes unless the value is one you constructed yourself, which
is necessarily valid UTF-8 because the only public constructors (FromStr and
TryFrom<String>) take a str.
No accessor on Headers hands out a HeaderValue, so this is not reachable through
one. Note From<HeaderValue> for String panics for the same reason.
Sourcepub fn as_bytes(&self) -> &[u8] ⓘ
pub fn as_bytes(&self) -> &[u8] ⓘ
Returns the bytes of this header value exactly as they were received
Unlike as_str, this is always available.
Sourcepub fn try_as_str(&self) -> Option<&str>
pub fn try_as_str(&self) -> Option<&str>
Returns the string representation of this header value, or None if it is not
valid UTF-8
Trait Implementations§
Source§impl AsRef<str> for HeaderValue
impl AsRef<str> for HeaderValue
Source§impl Clone for HeaderValue
impl Clone for HeaderValue
Source§impl Debug for HeaderValue
impl Debug for HeaderValue
Source§impl From<HeaderValue> for String
impl From<HeaderValue> for String
Source§fn from(value: HeaderValue) -> Self
fn from(value: HeaderValue) -> Self
Source§impl FromStr for HeaderValue
impl FromStr for HeaderValue
Auto Trait Implementations§
impl !Freeze for HeaderValue
impl RefUnwindSafe for HeaderValue
impl Send for HeaderValue
impl Sync for HeaderValue
impl Unpin for HeaderValue
impl UnsafeUnpin for HeaderValue
impl UnwindSafe for HeaderValue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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