[][src]Struct moxie::runtime::RunLoop

pub struct RunLoop<Root> { /* fields omitted */ }

A Runtime that is bound with a particular root function.

If running in a context with an async executor, can be consumed as a futures::Stream of crate::runtime::Revisions in order to provide the super::Runtime with a std::task::Waker.

Implementations

impl<Root, Out> RunLoop<Root> where
    Root: FnMut() -> Out + Unpin
[src]

pub fn new(root: Root) -> RunLoop<Root>[src]

Creates a new Runtime attached to the provided root function.

pub fn revision(&self) -> Revision[src]

Returns the runtime's current Revision.

pub fn set_state_change_waker(&mut self, wk: Waker)[src]

Sets the std::task::Waker which will be called when state variables change.

pub fn set_task_executor(&mut self, sp: impl LocalSpawn + 'static)[src]

Sets the executor that will be used to spawn normal priority tasks.

pub fn run_once(&mut self) -> Out[src]

Run the root function once within this runtime's context, returning the result.

pub async fn run_on_state_changes(__arg0: Self)[src]

Poll this runtime without exiting. Discards any value returned from the root function. The future yields in between revisions and is woken on state changes.

pub fn unloop(self) -> (Runtime, Root)[src]

Unbinds the runtime from its current root function, returning both.

Trait Implementations

impl<Root, Out> Stream for RunLoop<Root> where
    Root: FnMut() -> Out + Unpin
[src]

type Item = (Revision, Out)

Values yielded by the stream.

fn poll_next(
    self: Pin<&mut Self>,
    cx: &mut FutContext
) -> Poll<Option<Self::Item>>
[src]

This Stream implementation runs a single revision for each call to poll_next, always returning Poll::Ready(Some(...)).

Auto Trait Implementations

impl<Root> !RefUnwindSafe for RunLoop<Root>

impl<Root> !Send for RunLoop<Root>

impl<Root> !Sync for RunLoop<Root>

impl<Root> Unpin for RunLoop<Root> where
    Root: Unpin

impl<Root> !UnwindSafe for RunLoop<Root>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any

impl<T> Erased for T

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StreamExt for T where
    T: Stream + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.