pub struct Reactor<C, P: Poll> { /* private fields */ }Expand description
High-level reactor API wrapping reactor Runtime into a thread and providing basic thread
management for it.
Apps running the Reactor can interface it and a Handler via use of the Controller
API.
Implementations§
Source§impl<C, P: Poll> Reactor<C, P>
impl<C, P: Poll> Reactor<C, P>
Sourcepub fn named<H>(
service: H,
poller: P,
thread_name: String,
) -> Result<Self, Error>
pub fn named<H>( service: H, poller: P, thread_name: String, ) -> Result<Self, Error>
Creates new reactor using provided Poll engine and a service exposing Handler API to
the reactor.
Similar to the Reactor::new, but allows to specify the name for the reactor thread.
Both poll engine and the service are sent to the newly created reactor thread which runs the
reactor Runtime.
§Error
Errors with a system/OS error if it was impossible to spawn a thread.
Sourcepub fn with<H>(service: H, poller: P, builder: Builder) -> Result<Self, Error>
pub fn with<H>(service: H, poller: P, builder: Builder) -> Result<Self, Error>
Creates new reactor using provided Poll engine and a service exposing Handler API to
the reactor.
Similar to the Reactor::new, but allows to fully customize how the reactor thread is
constructed. Both poll engine and the service are sent to the newly created reactor
thread which runs the reactor Runtime.
§Error
Errors with a system/OS error if it was impossible to spawn a thread.
Sourcepub fn controller(&self) -> Controller<C, <P::Waker as Waker>::Send>
pub fn controller(&self) -> Controller<C, <P::Waker as Waker>::Send>
Provides a copy of a Controller object which exposes an API to the reactor and a service
running inside of its thread.
See Handler::Command for the details.