pub struct Header<E> { /* private fields */ }Expand description
Extracts header values as cache key parts.
Supports flexible header selection, value extraction, and transformation.
§Key Parts Generated
For each matched header, generates a KeyPart with:
- Key: the header name
- Value: the extracted (and optionally transformed) value
Implementations§
Source§impl<S> Header<NeutralExtractor<S>>
impl<S> Header<NeutralExtractor<S>>
Sourcepub fn new(name: String) -> Self
pub fn new(name: String) -> Self
Creates a header extractor for a single header by exact name.
The header value becomes a cache key part with the header name
as key. For more complex extraction (prefix matching, regex, transforms),
use Header::new_with.
Chain onto existing extractors using HeaderExtractor::header instead
if you already have an extractor chain.
Source§impl<E> Header<E>
impl<E> Header<E>
Sourcepub fn new_with(
inner: E,
name_selector: NameSelector,
value_extractor: ValueExtractor,
transforms: Vec<Transform>,
) -> Self
pub fn new_with( inner: E, name_selector: NameSelector, value_extractor: ValueExtractor, transforms: Vec<Transform>, ) -> Self
Creates a header extractor with full configuration options.
This constructor provides complete control over header extraction:
- Select headers by exact name or prefix pattern
- Extract full values or use regex capture groups
- Apply transformations (hash, lowercase, uppercase)
For simple exact-name extraction without transforms, use Header::new
or HeaderExtractor::header instead.
Trait Implementations§
Auto Trait Implementations§
impl<E> Freeze for Header<E>where
E: Freeze,
impl<E> RefUnwindSafe for Header<E>where
E: RefUnwindSafe,
impl<E> Send for Header<E>where
E: Send,
impl<E> Sync for Header<E>where
E: Sync,
impl<E> Unpin for Header<E>where
E: Unpin,
impl<E> UnwindSafe for Header<E>where
E: UnwindSafe,
Blanket Implementations§
Source§impl<E> BodyExtractor for Ewhere
E: Extractor,
impl<E> BodyExtractor for Ewhere
E: Extractor,
Source§fn body(self, extraction: BodyExtraction) -> Body<E>
fn body(self, extraction: BodyExtraction) -> Body<E>
Adds body extraction with the specified mode.
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