pub struct System(/* private fields */);Expand description
Runtime manager for a group of arbiter threads.
A system stores runtime configuration, manages arbiters, dispatches process signals, and owns the blocking thread pool.
Implementations§
Source§impl System
impl System
Sourcepub fn build() -> Builder
pub fn build() -> Builder
Creates a builder for a system with a customized runtime.
See Builder for the available configuration options.
Sourcepub fn new<R: Runner>(name: &str, runner: R) -> SystemRunner
pub fn new<R: Runner>(name: &str, runner: R) -> SystemRunner
Creates a system runner with the specified name and runtime runner.
§Panics
Panics if the runtime cannot be created.
Sourcepub fn with_config(name: &str, config: SystemConfig) -> SystemRunner
pub fn with_config(name: &str, config: SystemConfig) -> SystemRunner
Creates a system runner from an existing configuration.
§Panics
Panics if the runtime cannot be created.
Sourcepub fn current() -> System
pub fn current() -> System
Returns the system running on the current thread.
§Panics
Panics if no system is running on the current thread.
Sourcepub fn try_current() -> Option<System>
pub fn try_current() -> Option<System>
Returns the system running on the current thread, if one exists.
Sourcepub fn stop_with_code(&self, code: i32)
pub fn stop_with_code(&self, code: i32)
Stops the system with the specified exit code.
Sourcepub fn enable_signals(&self)
pub fn enable_signals(&self)
Enables process signal handling.
Sourcepub fn disable_signals(&self)
pub fn disable_signals(&self)
Disables process signal handling.
Sourcepub fn list_arbiters<F, R>(&self, f: F) -> R
pub fn list_arbiters<F, R>(&self, f: F) -> R
Provides access to all arbiters registered with this system.
This method should be called from the thread where the system has been initialized, typically the “main” thread.
Sourcepub fn list_arbiter_pings<F>(f: F)
pub fn list_arbiter_pings<F>(f: F)
Visits the latest ping records for each registered arbiter.
This method should be called from the thread where the system has been initialized, typically the “main” thread.
Sourcepub fn spawn_blocking<F, R>(&self, f: F) -> BlockingResult<R> ⓘ
pub fn spawn_blocking<F, R>(&self, f: F) -> BlockingResult<R> ⓘ
Spawns a blocking task on a new thread and waits for it to complete.
Dropping the returned future prevents queued work from starting, but
cannot interrupt work that is already running. Call
BlockingResult::detach to let queued work continue even if its
result is no longer needed.