Struct stream_httparse::Headers[][src]

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

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

Trait Implementations

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

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

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

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

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]

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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.

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.