System

Struct System 

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

System is a runtime manager.

Implementations§

Source§

impl System

Source

pub fn build() -> Builder

Build a new system with a customized tokio runtime.

This allows to customize the runtime. See struct level docs on Builder for more information.

Source

pub fn new<R: Runner>(name: &str, runner: R) -> SystemRunner

Create new system.

This method panics if it can not create tokio runtime

Source

pub fn with_config(name: &str, config: SystemConfig) -> SystemRunner

Create new system.

This method panics if it can not create tokio runtime

Source

pub fn current() -> System

Get current running system.

Source

pub fn id(&self) -> Id

System id

Source

pub fn stop(&self)

Stop the system

Source

pub fn stop_with_code(&self, code: i32)

Stop the system with a particular exit code.

Source

pub fn stop_on_panic(&self) -> bool

Return status of ‘stop_on_panic’ option which controls whether the System is stopped when an uncaught panic is thrown from a worker thread.

Source

pub fn arbiter(&self) -> &Arbiter

System arbiter

Source

pub fn list_arbiters<F, R>(f: F) -> R
where F: FnOnce(&[Arbiter]) -> R,

Retrieves a list of all arbiters in the system.

This method should be called from the thread where the system has been initialized, typically the “main” thread.

Source

pub fn list_arbiter_pings<F, R>(id: Id, f: F) -> R
where F: FnOnce(Option<&VecDeque<PingRecord>>) -> R,

Retrieves a list of last pings records for specified arbiter.

This method should be called from the thread where the system has been initialized, typically the “main” thread.

Source

pub fn config(&self) -> SystemConfig

System config

Source

pub fn spawn_blocking<F, R>(&self, f: F) -> BlockingResult<R>
where F: FnOnce() -> R + Send + 'static, R: Send + 'static,

Spawns a blocking task in a new thread, and wait for it.

The task will not be cancelled even if the future is dropped.

Trait Implementations§

Source§

impl Clone for System

Source§

fn clone(&self) -> System

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for System

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for System

§

impl !RefUnwindSafe for System

§

impl Send for System

§

impl Sync for System

§

impl Unpin for System

§

impl !UnwindSafe for System

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.