Struct stream_httparse::Headers [−][src]
pub struct Headers<'a> { /* fields omitted */ }
Expand description
A collection of Headers
Implementations
impl<'a> Headers<'a>
[src]
impl<'a> Headers<'a>
[src]pub fn new() -> Self
[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]
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]
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]
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]
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]
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]
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]
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]
pub fn get_header_count(&self) -> usize
[src]Returns the Number of Headers in this collection
Trait Implementations
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> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
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]
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