Struct stream_httparse::Headers[][src]

pub struct Headers<'a> { /* fields omitted */ }
Expand description

A collection of Headers

Implementations

impl<'a> Headers<'a>[src]

pub fn new() -> Self[src]

Creates a new Headers-Instance, for performance reasons it is recommended to use the with_capacity method as that would avoid frequent reallocations

pub fn with_capacity(cap: usize) -> Self[src]

Creates the Headers-Object with the given Capacity prereserved for future Headers. This should be used when you already kind of know how many Headers this will hold, as it will avoid extra allocations in the future

pub fn set<'b, K, V>(&mut self, key: K, value: V) where
    'b: 'a,
    K: Into<HeaderKey<'a>>,
    V: Into<HeaderValue<'a>>, 
[src]

Sets the Value of the of the Header for the given Key to the given Value

Behaviour

Checks if the Key is already present in the Collection and removes it if that is the case. Then adds the new Header to the End of the Collection

pub fn append<K, V>(&mut self, key: K, value: V) where
    K: Into<HeaderKey<'a>>,
    V: Into<HeaderValue<'a>>, 
[src]

Appends the given Key-Value Pair to the end of the Collection, without checking if the Key is already present in the Collection

pub fn remove<K>(&mut self, key: K) where
    K: Into<HeaderKey<'a>>, 
[src]

Removes the first Header, that matches the given Key, from the Collection

pub fn get<K>(&self, key: K) -> Option<&HeaderValue<'a>> where
    K: Into<HeaderKey<'a>>, 
[src]

Searches the Collection for a Header that matches the given Key

Returns:

  • None: if no Header matches the Key
  • A Reference to the underlying Header-Value that belongs to the Key

pub fn serialize(&self, buf: &mut Vec<u8>)[src]

Serializes the Collection of Headers into the given Buffer by append to it

pub fn get_max_value_size(&self) -> usize[src]

Returns the Size in bytes of the biggest Value as text.

This means that all the Header-Values in this collection can fit in a buffer of this size.

pub fn get_header_count(&self) -> usize[src]

Returns the Number of Headers in this collection

pub fn to_owned<'refed, 'owned>(&'refed self) -> Headers<'owned>[src]

Clones all the assosicated Data to produce a new and independant Header-Collection

Trait Implementations

impl<'a> Clone for Headers<'a>[src]

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

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'a> Debug for Headers<'a>[src]

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

Formats the value using the given formatter. Read more

impl<'a> Default for Headers<'a>[src]

fn default() -> Self[src]

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

impl<'a> PartialEq<Headers<'a>> for Headers<'a>[src]

fn eq(&self, other: &Headers<'a>) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Headers<'a>) -> bool[src]

This method tests for !=.

impl<'a> StructuralPartialEq for Headers<'a>[src]

Auto Trait Implementations

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.