Skip to main content

ClosureState

Struct ClosureState 

Source
pub struct ClosureState<I> { /* private fields */ }
Expand description

A timeout state for a timer using a closure as the triggering action.

Implementations§

Source§

impl<I> ClosureState<I>

Source

pub fn new<F>(id: I, action: F) -> Self
where F: FnOnce(I) + Send + 'static,

Produces a new instance of this state type from a unique id and the action to be executed when it expires.

Trait Implementations§

Source§

impl<I> Debug for ClosureState<I>
where I: Hash + Clone + Eq + Debug,

Source§

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

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

impl<I> State for ClosureState<I>
where I: Hash + Clone + Eq,

Source§

type Id = I

The type of the unique id of the outstanding timeout.
Source§

fn id(&self) -> &Self::Id

A reference to the id associated with this state.
Source§

fn trigger(self)

Trigger is called by the timer implementation when the timeout has expired.

Auto Trait Implementations§

§

impl<I> Freeze for ClosureState<I>
where I: Freeze,

§

impl<I> !RefUnwindSafe for ClosureState<I>

§

impl<I> Send for ClosureState<I>
where I: Send,

§

impl<I> !Sync for ClosureState<I>

§

impl<I> Unpin for ClosureState<I>
where I: Unpin,

§

impl<I> !UnwindSafe for ClosureState<I>

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

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.