pub enum Handled<T> {
Matched(T),
Unmatched,
}
Expand description
The reaction of an event handler to a particular event.
Handled
describes whether or not a handler has matched a particular event. When matched, a
handler may include an arbitrary output. When unmatched, there is no further output. Whether or
not a handler has matched an event can affect the execution of a composite handler and the test
harness.
Note that matching an event has no precise definition: handlers may react arbitrarily to
events. In practice, there is little ambiguity, but handlers and adapters can match in
particular ways to enable certain handler behaviors. See the until_first_match
adapter for
an example.
Variants§
Matched(T)
An event handler has matched and handled an event.
Unmatched
An event handler has not matched nor handled an event.
Implementations§
Source§impl<T> Handled<T>
impl<T> Handled<T>
pub fn map<U, F>(self, f: F) -> Handled<U>where
F: FnOnce(T) -> U,
pub fn and_then<U, F>(self, f: F) -> Handled<U>
pub fn and<U>(self, right: Handled<U>) -> Handled<U>
pub fn try_and_then<U, F>(self, f: F) -> Handled<U>
pub fn or_else<F>(self, f: F) -> Selfwhere
F: FnOnce() -> Self,
pub fn or(self, right: Self) -> Self
pub fn try_or_else<F>(self, f: F) -> Self
pub fn flatten(self) -> Handled<T::Output>where
T: Try,
pub fn matched(self) -> Option<T>
pub fn is_matched(&self) -> bool
pub fn is_unmatched(&self) -> bool
Trait Implementations§
Source§impl<T> Try for Handled<T>
impl<T> Try for Handled<T>
type Output = T
type Residual = Handled<Infallible>
fn from_output(output: Self::Output) -> Self
fn from_residual(_: Self::Residual) -> Self
fn branch(self) -> ControlFlow<Self::Residual, Self::Output>
fn unwrap(self) -> Self::Outputwhere
Self: Sized,
fn expect(self, message: impl Display) -> Self::Outputwhere
Self: Sized,
impl<T: Copy> Copy for Handled<T>
impl<T: Eq> Eq for Handled<T>
impl<T> StructuralPartialEq for Handled<T>
Auto Trait Implementations§
impl<T> Freeze for Handled<T>where
T: Freeze,
impl<T> RefUnwindSafe for Handled<T>where
T: RefUnwindSafe,
impl<T> Send for Handled<T>where
T: Send,
impl<T> Sync for Handled<T>where
T: Sync,
impl<T> Unpin for Handled<T>where
T: Unpin,
impl<T> UnwindSafe for Handled<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)