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<(), Error>

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<(), Error>
where F: FnOnce() -> Result<(), Error> + '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.

Source

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

Runs the system’s future in a local task set on an existing Tokio runtime.

Does not invoke the configured Runner or apply the builder’s signal and panic-handling settings. The system and primary arbiter are installed while the future runs, and shutdown callbacks are run on normal completion. Like block_on, this waits for the future rather than a stop request.

§Panics

Panics if used without a compatible Tokio runtime context. Panics from the future propagate to the caller.

Trait Implementations§

Source§

impl Debug for SystemRunner

Source§

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

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.