Struct tokio_bin_process::event_matcher::EventMatcher
source · pub struct EventMatcher { /* private fields */ }
Expand description
Use to check if an Event
matches certain criteria.
Construct by chaining methods, e.g:
assert!(
EventMatcher::new()
.with_level(Level::Info)
.with_target("module::internal_module")
.with_message("Some message")
.matches(event)
);
Implementations§
source§impl EventMatcher
impl EventMatcher
sourcepub fn new() -> EventMatcher
pub fn new() -> EventMatcher
Creates a new EventMatcher
that by default matches any Event.
sourcepub fn with_level(self, level: Level) -> EventMatcher
pub fn with_level(self, level: Level) -> EventMatcher
Sets the matcher to only match an Event
when it has the exact provided level
sourcepub fn with_target(self, target: &str) -> EventMatcher
pub fn with_target(self, target: &str) -> EventMatcher
Sets the matcher to only match an Event
when it has the exact provided target
sourcepub fn with_message(self, message: &str) -> EventMatcher
pub fn with_message(self, message: &str) -> EventMatcher
Sets the matcher to only match an Event
when it has the exact provided message
sourcepub fn with_count(self, count: Count) -> EventMatcher
pub fn with_count(self, count: Count) -> EventMatcher
Defines how many times the matcher must match to pass an assertion
This is not used internally i.e. it has no effect on EventMatcher::matches
Instead its only used by higher level assertion logic.
Trait Implementations§
source§impl Debug for EventMatcher
impl Debug for EventMatcher
source§impl Default for EventMatcher
impl Default for EventMatcher
source§fn default() -> EventMatcher
fn default() -> EventMatcher
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl RefUnwindSafe for EventMatcher
impl Send for EventMatcher
impl Sync for EventMatcher
impl Unpin for EventMatcher
impl UnwindSafe for EventMatcher
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