Timewrap

Struct Timewrap 

Source
pub struct Timewrap<T, S = ()>
where T: Time,
{ /* private fields */ }

Implementations§

Source§

impl<T, S> Timewrap<T, S>
where T: Time + Default, S: Default,

Source

pub fn new() -> Self

Source§

impl<T, S> Timewrap<T, S>
where T: Time, S: Default,

Source

pub fn new_with_time(time: T) -> Self

Source§

impl<T, S> Timewrap<T, S>
where T: Time + Default,

Source

pub fn new_with_state(state: S) -> Self

Source§

impl<T, S> Timewrap<T, S>
where T: Time,

Source

pub fn new_with_time_and_state(time: T, state: S) -> Self

Source

pub fn current_time(&self) -> T

Source

pub fn state(&self) -> &S

Source

pub fn into_state(self) -> S

Source

pub fn spawn<F>(&self, f: F)
where F: for<'a> FnOnce(TimewrapHandle<'a, T, S>) -> Pin<Box<dyn Future<Output = ()> + Send + 'a>>,

Source

pub fn spawn_at<F>(&self, time: T, f: F)
where F: for<'a> FnOnce(TimewrapHandle<'a, T, S>) -> Pin<Box<dyn Future<Output = ()> + Send + 'a>>,

Source

pub async fn drive(&mut self, time: T)

Trait Implementations§

Source§

impl<T, S> Default for Timewrap<T, S>
where T: Time + Default, S: Default,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T, S> Deref for Timewrap<T, S>
where T: Time,

Source§

type Target = S

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl<T, S> Freeze for Timewrap<T, S>

§

impl<T, S = ()> !RefUnwindSafe for Timewrap<T, S>

§

impl<T, S> Send for Timewrap<T, S>
where S: Send, T: Send,

§

impl<T, S> Sync for Timewrap<T, S>
where S: Sync, T: Send,

§

impl<T, S> Unpin for Timewrap<T, S>

§

impl<T, S = ()> !UnwindSafe for Timewrap<T, S>

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.