Struct stream_httparse::Headers [−][src]
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]
'b: 'a,
K: Into<HeaderKey<'a>>,
V: Into<HeaderValue<'a>>,
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]
K: Into<HeaderKey<'a>>,
V: Into<HeaderValue<'a>>,
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]
K: Into<HeaderKey<'a>>,
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]
K: Into<HeaderKey<'a>>,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
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]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,