#[non_exhaustive]pub enum HeaderMatcher {
Equals(Value),
Regex(String),
Exists,
}Expand description
A matcher over a received header value.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Equals(Value)
The header value equals the given JSON value.
Regex(String)
The header value (a string) matches the given regular expression.
Exists
The header key is present (any value, including JSON null).
Implementations§
Source§impl HeaderMatcher
impl HeaderMatcher
Sourcepub fn matches(&self, actual: Option<&Value>) -> bool
pub fn matches(&self, actual: Option<&Value>) -> bool
Evaluate this matcher against a received header value.
Sourcepub fn regex_pattern(&self) -> Option<&str>
pub fn regex_pattern(&self) -> Option<&str>
The regex pattern, if this is a HeaderMatcher::Regex.
Trait Implementations§
Source§impl Clone for HeaderMatcher
impl Clone for HeaderMatcher
Source§fn clone(&self) -> HeaderMatcher
fn clone(&self) -> HeaderMatcher
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 HeaderMatcher
impl Debug for HeaderMatcher
Auto Trait Implementations§
impl Freeze for HeaderMatcher
impl RefUnwindSafe for HeaderMatcher
impl Send for HeaderMatcher
impl Sync for HeaderMatcher
impl Unpin for HeaderMatcher
impl UnsafeUnpin for HeaderMatcher
impl UnwindSafe for HeaderMatcher
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