pub struct Reactor { /* private fields */ }Available on Windows only.
Expand description
A handle for submitting work to a reactor.
Cloneable. The reactor thread implicitly shuts down after all clones are dropped and no work remains.
Implementations§
Source§impl Reactor
impl Reactor
Sourcepub async fn new() -> Result<(Reactor, Control)>
pub async fn new() -> Result<(Reactor, Control)>
Spawns the reactor thread, returning a cloneable submission handle alongside the unique handle that controls its lifecycle.
Sourcepub fn submit<T, F>(&self, f: F) -> Result<Task<T>, Closed>
pub fn submit<T, F>(&self, f: F) -> Result<Task<T>, Closed>
Submits f to run on the reactor thread, returning a future for its
result.
f receives a Context for cooperative cancellation
(Context::cancel_guard) and task self-submission
(Context::submit).
Fails with Closed once Control::close has been called.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Reactor
impl RefUnwindSafe for Reactor
impl Send for Reactor
impl Sync for Reactor
impl Unpin for Reactor
impl UnsafeUnpin for Reactor
impl UnwindSafe for Reactor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more