pub trait Driver: 'static {
// Required methods
fn handle(&self) -> Box<dyn Notify>;
fn run(&self, rt: &Runtime) -> Result<()>;
// Provided method
fn clear(&self) { ... }
}Expand description
Required Methods§
Sourcefn handle(&self) -> Box<dyn Notify>
fn handle(&self) -> Box<dyn Notify>
Returns a thread-safe notifier for this driver’s event loop.
Sourcefn run(&self, rt: &Runtime) -> Result<()>
fn run(&self, rt: &Runtime) -> Result<()>
Drives the runtime until Runtime::poll returns PollResult::Ready.
Called by Runtime::block_on with rt active on the current thread.
Process external events between polls, without blocking when the result
is PollResult::PollAgain. Call Runtime::awake after waiting for
events, before dispatching events that may wake tasks.
Returns an error if the event loop cannot continue.
Provided Methods§
Sourcefn clear(&self)
fn clear(&self)
Releases driver-owned state when requested by its owner.
The default implementation does nothing. Runtime::block_on does not
call this hook.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".