wlan_hw_sim::event

Enum Handled

Source
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>

Source

pub fn map<U, F>(self, f: F) -> Handled<U>
where F: FnOnce(T) -> U,

Source

pub fn and_then<U, F>(self, f: F) -> Handled<U>
where F: FnOnce(T) -> Handled<U>,

Source

pub fn and<U>(self, right: Handled<U>) -> Handled<U>

Source

pub fn try_and_then<U, F>(self, f: F) -> Handled<U>
where T: Try, F: FnOnce(T::Output) -> Handled<U>,

Source

pub fn or_else<F>(self, f: F) -> Self
where F: FnOnce() -> Self,

Source

pub fn or(self, right: Self) -> Self

Source

pub fn try_or_else<F>(self, f: F) -> Self
where T: Try, F: FnOnce() -> Self,

Source

pub fn flatten(self) -> Handled<T::Output>
where T: Try,

Source

pub fn matched(self) -> Option<T>

Source

pub fn is_matched(&self) -> bool

Source

pub fn is_unmatched(&self) -> bool

Trait Implementations§

Source§

impl<T: Clone> Clone for Handled<T>

Source§

fn clone(&self) -> Handled<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for Handled<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> From<T> for Handled<T>

Source§

fn from(matched: T) -> Self

Converts to this type from the input type.
Source§

impl<T: PartialEq> PartialEq for Handled<T>

Source§

fn eq(&self, other: &Handled<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> Try for Handled<T>

Source§

type Output = T

Source§

type Residual = Handled<Infallible>

Source§

fn from_output(output: Self::Output) -> Self

Source§

fn from_residual(_: Self::Residual) -> Self

Source§

fn branch(self) -> ControlFlow<Self::Residual, Self::Output>

Source§

fn unwrap(self) -> Self::Output
where Self: Sized,

Source§

fn expect(self, message: impl Display) -> Self::Output
where Self: Sized,

Source§

impl<T: Copy> Copy for Handled<T>

Source§

impl<T: Eq> Eq for Handled<T>

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
§

impl<T, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T> From<!> for T

Source§

fn from(t: !) -> T

Converts to this type from the input type.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> IntoAny for T
where T: 'static + Send + Sync,

§

fn into_any(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Cast the given object into a dyn std::any::Any.
Source§

impl<T> OptionalField for T
where T: ?Sized,

Source§

const PRESENT: Presence<Self> = _

Source§

const ABSENT: Presence<Self> = _

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<St> WithTag for St

§

fn tagged<T>(self, tag: T) -> Tagged<T, St>

Produce a new stream from this one which yields item tupled with a constant tag