pub struct EventMatcher {
pub event_type: Option<EventTypeMatcher>,
pub target_monikers: Option<MonikerMatcher>,
pub capability_name: Option<CapabilityNameMatcher>,
pub exit_status: Option<ExitStatusMatcher>,
pub event_is_ok: Option<EventIsOkMatcher>,
}
Fields§
§event_type: Option<EventTypeMatcher>
§target_monikers: Option<MonikerMatcher>
§capability_name: Option<CapabilityNameMatcher>
§exit_status: Option<ExitStatusMatcher>
§event_is_ok: Option<EventIsOkMatcher>
Implementations§
Source§impl EventMatcher
impl EventMatcher
pub fn ok() -> Self
pub fn err() -> Self
pub fn type(self, event_type: EventType) -> Self
Sourcepub fn moniker(self, moniker: impl Into<String>) -> Self
pub fn moniker(self, moniker: impl Into<String>) -> Self
The expected target moniker. Will panic if the moniker is invalid.
Sourcepub fn monikers<I, S>(self, monikers: I) -> Self
pub fn monikers<I, S>(self, monikers: I) -> Self
The expected target monikers. Will panic if any moniker is invalid.
Sourcepub fn moniker_regex(self, moniker: impl Into<String>) -> Self
pub fn moniker_regex(self, moniker: impl Into<String>) -> Self
The expected target moniker as a regular expression.
If the exact moniker is known, use the moniker
method instead.
Sourcepub fn monikers_regex<I, S>(self, monikers: I) -> Self
pub fn monikers_regex<I, S>(self, monikers: I) -> Self
The expected target monikers as regular expressions. This will match against
regular expression in the iterator provided. If the exact monikers are known,
use the monikers
method instead.
Sourcepub fn capability_name(self, capability_name: impl Into<String>) -> Self
pub fn capability_name(self, capability_name: impl Into<String>) -> Self
The expected capability name.
Sourcepub fn stop(self, exit_status: Option<ExitStatusMatcher>) -> Self
pub fn stop(self, exit_status: Option<ExitStatusMatcher>) -> Self
The expected exit status. Only applies to the Stop event.
Sourcepub async fn expect_match<T: Event>(
&mut self,
event_stream: &mut EventStream,
) -> T
pub async fn expect_match<T: Event>( &mut self, event_stream: &mut EventStream, ) -> T
Expects the next event to match the provided EventMatcher. Returns the casted type if successful and an error otherwise.
Sourcepub async fn wait<T: Event>(
self,
event_stream: &mut EventStream,
) -> Result<T, Error>
pub async fn wait<T: Event>( self, event_stream: &mut EventStream, ) -> Result<T, Error>
Waits for an event matching the matcher. Implicitly resumes all other events. Returns the casted type if successful and an error otherwise.
pub fn matches(&self, other: &EventDescriptor) -> Result<(), EventMatcherError>
Trait Implementations§
Source§impl Clone for EventMatcher
impl Clone for EventMatcher
Source§fn clone(&self) -> EventMatcher
fn clone(&self) -> EventMatcher
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for EventMatcher
impl Debug for EventMatcher
Source§impl Default for EventMatcher
impl Default for EventMatcher
Source§fn default() -> EventMatcher
fn default() -> EventMatcher
Auto Trait Implementations§
impl Freeze for EventMatcher
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more