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) -> Header<NeutralExtractor<S>>
pub fn new(name: String) -> Header<NeutralExtractor<S>>
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>,
) -> Header<E>
pub fn new_with( inner: E, name_selector: NameSelector, value_extractor: ValueExtractor, transforms: Vec<Transform>, ) -> Header<E>
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§
Source§impl<ReqBody, E> Extractor for Header<E>
impl<ReqBody, E> Extractor for Header<E>
Source§type Subject = <E as Extractor>::Subject
type Subject = <E as Extractor>::Subject
The type from which cache key components are extracted.
Source§fn get<'life0, 'async_trait>(
&'life0 self,
subject: <Header<E> as Extractor>::Subject,
) -> Pin<Box<dyn Future<Output = KeyParts<<Header<E> as Extractor>::Subject>> + Send + 'async_trait>>where
'life0: 'async_trait,
Header<E>: 'async_trait,
fn get<'life0, 'async_trait>(
&'life0 self,
subject: <Header<E> as Extractor>::Subject,
) -> Pin<Box<dyn Future<Output = KeyParts<<Header<E> as Extractor>::Subject>> + Send + 'async_trait>>where
'life0: 'async_trait,
Header<E>: 'async_trait,
Extract cache key components from the subject. Read more
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