[][src]Struct sonr::system::System

pub struct System { /* fields omitted */ }

System is thread local and has to exist for each thread using Reactors that react to Reaction::Event(event). There can only be one instance of a System per thread, and this instance is created by calling System::init().

Methods

impl System[src]

pub fn init() -> Result<SignalSender<SystemEvent>>[src]

Initialise the system for the current thread. Should only be called once per thread.

pub fn register(
    evented: &impl Evented,
    interest: Ready,
    token: Token
) -> Result<()>
[src]

Register an Evented with the System.

pub fn reregister<T: Evented>(evented: &EventedReactor<T>) -> Result<()>[src]

Reregister an evented reactor.

pub fn start<R: Reactor>(reactor: R) -> Result<()>[src]

Start the event loop. This will run until SystemEvent::Stop is sent to the system's SignalReceiver.

The SignalReceiver is returned from System::init().

pub fn free_token(token: Token)[src]

The token can be registered with another reactor. This is called when an EventedReactor is dropped.

pub fn reserve_token() -> Result<Token>[src]

Reserve a token

pub fn send(sys_event: SystemEvent)[src]

Send a system event to the current system.

Auto Trait Implementations

impl Send for System

impl Sync for System

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Erased for T