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
impl SystemRunner
Sourcepub fn run_until_stop(self) -> Result<()>
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.
Sourcepub fn run<F>(self, f: F) -> Result<()>
pub fn run<F>(self, f: F) -> Result<()>
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.
Sourcepub fn block_on<F, R>(self, fut: F) -> Rwhere
F: Future<Output = R> + 'static,
R: 'static,
pub fn block_on<F, R>(self, fut: F) -> Rwhere
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.