Skip to main content

SystemRunner

Struct SystemRunner 

Source
pub struct SystemRunner { /* private fields */ }
Expand description

A configured system that has not yet started its event loop.

Driving it installs a system and primary arbiter on the current thread. This value is neither Send nor Sync.

Implementations§

Source§

impl SystemRunner

Source

pub fn run_until_stop(self) -> Result<()>

Runs the event loop until System::stop() is called.

Equivalent to run with an initialization callback that returns Ok(()), including its error and panic behavior.

Source

pub fn run<F>(self, f: F) -> Result<()>
where F: FnOnce() -> Result<()> + 'static,

Runs f, then drives the event loop until System::stop() is called.

The callback runs inside the event loop with the system and its primary arbiter installed. On exit, the system requests its arbiters to stop.

§Errors

Returns the initialization error from f, or an error if the system stops with a nonzero exit code or its stop channel closes unexpectedly.

§Panics

Resumes panics from initialization or the runtime runner after cleanup. Also panics if the runner returns successfully without completing its supplied future.

Source

pub fn block_on<F, R>(self, fut: F) -> R
where F: Future<Output = R> + 'static, R: 'static,

Runs the system until fut completes and returns its output.

The future runs with the system and primary arbiter installed. Completion requests all system arbiters to stop. Unlike run, this waits for the future, not a stop request, and does not check the system’s exit code.

§Panics

Resumes panics from the future or runtime runner after cleanup. Also panics if the runner returns without completing its supplied future.

Trait Implementations§

Source§

impl Debug for SystemRunner

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.