Headers

Struct Headers 

Source
pub struct Headers<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> Headers<'a>

Source

pub const CONTENT_LENGTH: &'static str = "content-length"

Source

pub const CONTENT_TYPE: &'static str = "content-type"

Source

pub const TRANSFER_ENCODING: &'static str = "transfer-encoding"

Source

pub const CONNECTION: &'static str = "connection"

Source

pub fn empty() -> &'static Headers<'static>

Source

pub fn empty_nodate() -> &'static Headers<'static>

Source

pub fn close() -> &'static Headers<'static>

for request-head errors

Source

pub fn new() -> Self

Source

pub fn new_nodate() -> Self

Source

pub fn iter(&self) -> Iter<'_, (Cow<'a, str>, Cow<'a, [u8]>)>

Source

pub fn iter_mut(&mut self) -> IterMut<'_, (Cow<'a, str>, Cow<'a, [u8]>)>

Source

pub fn get_count(&self) -> usize

Source

pub fn add<N, V>(&mut self, name: N, value: V)
where N: Into<Cow<'a, str>>, V: Into<Cow<'a, [u8]>>,

Source

pub fn get(&self, name: &str) -> Option<&[u8]>

Source

pub fn get_all<'s>( &'s self, name: &'s str, ) -> impl Iterator<Item = &'s (Cow<'a, str>, Cow<'a, [u8]>)>

Source

pub fn replace<N, V>(&mut self, name: N, value: V)
where N: Into<Cow<'a, str>>, V: Into<Cow<'a, [u8]>>,

Source

pub fn remove(&mut self, name: &str)

Source

pub fn get_content_length(&self) -> Option<u64>

Source

pub fn set_content_length(&mut self, len: Option<u64>)

Source

pub fn set_transfer_encoding_chunked(&mut self)

Source

pub fn is_transfer_encoding_chunked(&self) -> bool

Source

pub fn get_transfer_encoding(&self) -> Vec<Vec<u8>>

Returns all transfer-encoding tokens (comma-split, trimmed)

Source

pub fn is_with_date_header(&self) -> bool

Source

pub fn set_connection_close(&mut self)

Source

pub fn is_connection_close(&self) -> bool

Source

pub fn get_connection_values(&self) -> Vec<Vec<u8>>

Returns all connection header tokens (comma-split, trimmed)

Source

pub fn is_100_continue(&self) -> bool

Trait Implementations§

Source§

impl<'a> Clone for Headers<'a>

Source§

fn clone(&self) -> Headers<'a>

Returns a duplicate 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<'a> Debug for Headers<'a>

Source§

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

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

impl<'a> Default for Headers<'a>

Source§

fn default() -> Headers<'a>

Returns the “default value” for a type. Read more
Source§

impl Display for Headers<'_>

Source§

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

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

impl<'a> From<&'a [(&str, &[u8])]> for Headers<'a>

Source§

fn from(slice: &'a [(&str, &[u8])]) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Vec<(Cow<'a, str>, Cow<'a, [u8]>)>> for Headers<'a>

Source§

fn from(vec: Vec<(Cow<'a, str>, Cow<'a, [u8]>)>) -> Headers<'a>

Converts to this type from the input type.
Source§

impl<'a> IntoIterator for &'a Headers<'a>

Source§

type Item = &'a (Cow<'a, str>, Cow<'a, [u8]>)

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, (Cow<'a, str>, Cow<'a, [u8]>)>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a> IntoIterator for &'a mut Headers<'a>

Source§

type Item = &'a mut (Cow<'a, str>, Cow<'a, [u8]>)

The type of the elements being iterated over.
Source§

type IntoIter = IterMut<'a, (Cow<'a, str>, Cow<'a, [u8]>)>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a> PartialEq for Headers<'a>

Source§

fn eq(&self, other: &Headers<'a>) -> 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.
Source§

impl<'a> StructuralPartialEq for Headers<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Headers<'a>

§

impl<'a> RefUnwindSafe for Headers<'a>

§

impl<'a> Send for Headers<'a>

§

impl<'a> Sync for Headers<'a>

§

impl<'a> Unpin for Headers<'a>

§

impl<'a> UnwindSafe for Headers<'a>

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
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, dest: *mut u8)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.