pub struct HttpHeaders { /* private fields */ }Expand description
An owning HTTP header interpreter with lazy lookup and explicit trailer
accumulation. Initial and trailing sections remain distinguishable; raw
Fields never carries an interpreter or a hidden trailer marker.
Implementations§
Source§impl HttpHeaders
impl HttpHeaders
pub fn new(fields: Fields) -> Self
pub fn try_from_pairs<N: AsRef<str>, V: AsRef<[u8]>>( pairs: impl IntoIterator<Item = (N, V)>, ) -> Result<Self, FieldError>
pub fn with_policy(fields: Fields, policy: Policy) -> Self
Sourcepub fn into_parts(self) -> (Fields, Option<Fields>)
pub fn into_parts(self) -> (Fields, Option<Fields>)
Recover the initial and trailing sections without losing their provenance.
pub fn pairs(&self) -> &[Field]
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn tail(&self) -> Option<usize>
pub fn has_trailers(&self) -> bool
pub fn headers(&self) -> &[Field]
pub fn trailers(&self) -> &[Field]
pub fn policy(&self) -> &Policy
Sourcepub fn set_policy(&mut self, policy: Policy)
pub fn set_policy(&mut self, policy: Policy)
Changing policy invalidates interpreted values; validation is deferred.
Sourcepub fn append_trailers(&mut self, fields: Fields) -> Result<(), FieldError>
pub fn append_trailers(&mut self, fields: Fields) -> Result<(), FieldError>
Explicitly append a received trailing section. Failed validation leaves this interpreter unchanged, including its cached index and section split.
pub fn values<'a>( &'a self, name: &'a str, ) -> impl Iterator<Item = &'a [u8]> + 'a
pub fn contains(&self, name: &str) -> bool
pub fn add( &mut self, name: impl AsRef<str>, value: impl AsRef<[u8]>, ) -> Result<(), FieldError>
pub fn append(&mut self, field: Field) -> Result<(), FieldError>
Sourcepub fn set(
&mut self,
name: impl AsRef<str>,
value: impl AsRef<[u8]>,
) -> Result<(), FieldError>
pub fn set( &mut self, name: impl AsRef<str>, value: impl AsRef<[u8]>, ) -> Result<(), FieldError>
Replace all matching pairs and append in the current section. Validation failures leave the original collection and its cached index unchanged.
Sourcepub fn remove(&mut self, name: &str) -> usize
pub fn remove(&mut self, name: &str) -> usize
Remove matching pairs in both sections, preserving the trailer boundary.
pub fn clear(&mut self)
pub fn get(&mut self, name: &str) -> Result<Option<&FieldValue>, FieldError>
Sourcepub fn index(&mut self) -> Result<&Index, FieldError>
pub fn index(&mut self) -> Result<&Index, FieldError>
Validate and cache the whole semantic index. Failed builds are not cached, so removing an offending pair or changing policy can repair the collection.