pub enum HttpHeaders {
Modern(HashMap<String, Vec<String>>),
}Expand description
Represents HTTP headers in either legacy or modern format.
Values are Strings, so header values that are not valid UTF-8 cannot
be represented and are skipped during conversion from http::HeaderMap.
Variants§
Implementations§
Source§impl HttpHeaders
impl HttpHeaders
Sourcepub fn insert(&mut self, key: String, value: String)
pub fn insert(&mut self, key: String, value: String)
Inserts a header key-value pair, replacing any existing values for that key Keys are normalized to lowercase per RFC 7230
Sourcepub fn append(&mut self, key: String, value: String)
pub fn append(&mut self, key: String, value: String)
Appends a header value, preserving existing values for the same key Keys are normalized to lowercase per RFC 7230
Sourcepub fn get(&self, key: &str) -> Option<&String>
pub fn get(&self, key: &str) -> Option<&String>
Retrieves the first value for a given header key Keys are normalized to lowercase per RFC 7230
Sourcepub fn remove(&mut self, key: &str)
pub fn remove(&mut self, key: &str)
Removes a header key and its associated values Keys are normalized to lowercase per RFC 7230
Sourcepub fn contains_key(&self, key: &str) -> bool
pub fn contains_key(&self, key: &str) -> bool
Checks if a header key exists Keys are normalized to lowercase per RFC 7230
Sourcepub fn iter(&self) -> HttpHeadersIterator<'_> ⓘ
pub fn iter(&self) -> HttpHeadersIterator<'_> ⓘ
Returns an iterator over the header key-value pairs
Trait Implementations§
Source§impl Clone for HttpHeaders
impl Clone for HttpHeaders
Source§fn clone(&self) -> HttpHeaders
fn clone(&self) -> HttpHeaders
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HttpHeaders
impl Debug for HttpHeaders
Source§impl Default for HttpHeaders
impl Default for HttpHeaders
Source§impl<'de> Deserialize<'de> for HttpHeaders
impl<'de> Deserialize<'de> for HttpHeaders
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<&HeaderMap> for HttpHeaders
impl From<&HeaderMap> for HttpHeaders
Source§impl From<HttpHeaders> for HashMap<String, Vec<String>>
impl From<HttpHeaders> for HashMap<String, Vec<String>>
Source§fn from(headers: HttpHeaders) -> Self
fn from(headers: HttpHeaders) -> Self
Converts to this type from the input type.
Source§impl IntoIterator for HttpHeaders
impl IntoIterator for HttpHeaders
Source§impl<'a> IntoIterator for &'a HttpHeaders
impl<'a> IntoIterator for &'a HttpHeaders
Auto Trait Implementations§
impl Freeze for HttpHeaders
impl RefUnwindSafe for HttpHeaders
impl Send for HttpHeaders
impl Sync for HttpHeaders
impl Unpin for HttpHeaders
impl UnsafeUnpin for HttpHeaders
impl UnwindSafe for HttpHeaders
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more