pub struct Header<'a> { /* private fields */ }Expand description
A zero-copy view of a single HTTP header.
Implementations§
Source§impl<'a> Header<'a>
impl<'a> Header<'a>
Sourcepub fn name_bytes(&self) -> &'a [u8] ⓘ
pub fn name_bytes(&self) -> &'a [u8] ⓘ
Returns the header name as raw bytes.
Sourcepub fn as_bytes_pair(&self) -> (&'a [u8], &'a [u8])
pub fn as_bytes_pair(&self) -> (&'a [u8], &'a [u8])
Returns the header as a raw (&[u8], &[u8]) pair.
This is useful for zero-allocation header processing.
Sourcepub fn value_str(&self) -> Option<&'a str>
pub fn value_str(&self) -> Option<&'a str>
Returns the header value as a string, if valid UTF-8.
Sourcepub fn name_eq_ignore_case(&self, other: &str) -> bool
pub fn name_eq_ignore_case(&self, other: &str) -> bool
Returns true if this header name matches (case-insensitive).
Sourcepub fn is_content_length(&self) -> bool
pub fn is_content_length(&self) -> bool
Returns true if this is the Content-Length header.
Sourcepub fn is_transfer_encoding(&self) -> bool
pub fn is_transfer_encoding(&self) -> bool
Returns true if this is the Transfer-Encoding header.
Sourcepub fn as_content_length(&self) -> Option<usize>
pub fn as_content_length(&self) -> Option<usize>
Parses the value as Content-Length (usize).
Returns None if this isn’t Content-Length or value isn’t a valid integer.
Sourcepub fn is_chunked_encoding(&self) -> bool
pub fn is_chunked_encoding(&self) -> bool
Returns true if Transfer-Encoding includes “chunked”.
Trait Implementations§
impl<'a> Copy for Header<'a>
Auto Trait Implementations§
impl<'a> Freeze for Header<'a>
impl<'a> RefUnwindSafe for Header<'a>
impl<'a> Send for Header<'a>
impl<'a> Sync for Header<'a>
impl<'a> Unpin for Header<'a>
impl<'a> UnwindSafe for Header<'a>
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
Mutably borrows from an owned value. Read more
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: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).