pub struct HeaderValueWrapper(pub HeaderValue);
Tuple Fields§
§0: HeaderValue
Methods from Deref<Target = HeaderValue>§
pub fn to_str(&self) -> Result<&str, ToStrError>
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
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
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] ⓘ
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 is_sensitive(&self) -> bool
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§
Source§impl Clone for HeaderValueWrapper
impl Clone for HeaderValueWrapper
Source§fn clone(&self) -> HeaderValueWrapper
fn clone(&self) -> HeaderValueWrapper
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for HeaderValueWrapper
impl Debug for HeaderValueWrapper
Source§impl Deref for HeaderValueWrapper
impl Deref for HeaderValueWrapper
Source§impl<'de> Deserialize<'de> for HeaderValueWrapper
impl<'de> Deserialize<'de> for HeaderValueWrapper
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl From<HeaderValue> for HeaderValueWrapper
impl From<HeaderValue> for HeaderValueWrapper
Source§impl From<HeaderValueWrapper> for HeaderValue
impl From<HeaderValueWrapper> for HeaderValue
Source§fn from(wrapper: HeaderValueWrapper) -> Self
fn from(wrapper: HeaderValueWrapper) -> Self
Source§impl FromStr for HeaderValueWrapper
impl FromStr for HeaderValueWrapper
Auto Trait Implementations§
impl !Freeze for HeaderValueWrapper
impl RefUnwindSafe for HeaderValueWrapper
impl Send for HeaderValueWrapper
impl Sync for HeaderValueWrapper
impl Unpin for HeaderValueWrapper
impl UnwindSafe for HeaderValueWrapper
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 40 bytes