#[non_exhaustive]pub enum BodyMatcher {
Equals(Body),
Regex(String),
Contains(String),
StartsWith(String),
EndsWith(String),
Exists,
JsonSubset(Value),
}Expand description
A matcher over a received Body.
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(Body)
The body equals the given value (variant-tagged structural equality).
Regex(String)
The body text matches the given regular expression.
Contains(String)
The body text contains the given substring.
StartsWith(String)
The body text starts with the given prefix.
EndsWith(String)
The body text ends with the given suffix.
Exists
The body is present (any variant except Empty).
JsonSubset(Value)
The body is a JSON object that is a superset of the given object.
Implementations§
Source§impl BodyMatcher
impl BodyMatcher
Sourcepub fn regex_pattern(&self) -> Option<&str>
pub fn regex_pattern(&self) -> Option<&str>
The regex pattern, if this is a BodyMatcher::Regex.
Sourcepub fn mismatch_note(&self, actual: &Body) -> Option<&'static str>
pub fn mismatch_note(&self, actual: &Body) -> Option<&'static str>
A short note explaining why a non-matching body failed, when the failure is a shape mismatch rather than a value mismatch.
Trait Implementations§
Source§impl Clone for BodyMatcher
impl Clone for BodyMatcher
Source§fn clone(&self) -> BodyMatcher
fn clone(&self) -> BodyMatcher
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 BodyMatcher
impl Debug for BodyMatcher
Auto Trait Implementations§
impl !Freeze for BodyMatcher
impl !RefUnwindSafe for BodyMatcher
impl !UnwindSafe for BodyMatcher
impl Send for BodyMatcher
impl Sync for BodyMatcher
impl Unpin for BodyMatcher
impl UnsafeUnpin for BodyMatcher
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