Expand description
Event loop that drives Tokio I/O resources.
Note: This crate is deprecated in tokio 0.2.x and has been moved and refactored into various places in the
tokio::runtimeandtokio::iomodules of thetokiocrate. The Reactor has also been renamed the “I/O Driver”.
The reactor is the engine that drives asynchronous I/O resources (like TCP and
UDP sockets). It is backed by mio and acts as a bridge between mio and
futures.
The crate provides:
-
Reactoris the main type of this crate. It performs the event loop logic. -
Handleprovides a reference to a reactor instance. -
RegistrationandPollEventedallow third parties to implement I/O resources that are driven by the reactor.
Application authors will not use this crate directly. Instead, they will use the
tokio crate. Library authors should only depend on tokio-reactor if they
are building a custom I/O resource.
For more details, see reactor module documentation in the Tokio crate.
Structs§
- Background
- Handle to the reactor running on a background thread.
- Default
Guard - Ensure that the default reactor is removed from the thread-local context when leaving the scope. This handles cases that involve panicking.
- Handle
- A reference to a reactor.
- Poll
Evented - Associates an I/O resource that implements the
std::io::Readand/orstd::io::Writetraits with the reactor that drives it. - Reactor
- The core reactor, or event loop.
- Registration
- Associates an I/O resource with the reactor instance that drives it.
- SetFallback
Error - Error returned from
Handle::set_fallback. - Shutdown
- Future that resolves when the reactor thread has shutdown.
- Turn
- Return value from the
turnmethod onReactor.
Functions§
- set_
default - Sets
handleas the default reactor, returning a guard that unsets it when dropped. - with_
default - Set the default reactor for the duration of the closure