PoolHandle

Struct PoolHandle 

Source
pub struct PoolHandle<R> { /* private fields */ }
Expand description

A handle to a currently executing mio pool.

This handle can be used to terminate the running pool, and to wait for its completion. See PoolHandle::terminate and PoolHandle::wait for details.

Implementations§

Source§

impl<R> PoolHandle<R>

Source

pub fn terminate(self) -> Vec<Result<R>>

Tell all running workers to terminate, and then wait for their completion.

Note that this will not wait for existing connections to terminate, but termination may be delayed until the next time each worker is idle.

Source

pub fn finish(self) -> Vec<Result<R>>

Stop accepting connections and wait for existing connections to complete.

This method will tell worker threads not to accept new connetions, and to exit once all current connections have been closed.

Note that this method will not immediately drop the Listener, so new clients that try to connect will hang (i.e., not get a connection refused) until the workers have all exited.

Source

pub fn wait(self) -> Vec<Result<R>>

Wait for all running workers to terminate.

This method will not tell worker threads to exit, and so will only return once when all worker threads have crashed (which should not happen in general). Users may instead want to use PoolHandle::terminate.

Auto Trait Implementations§

§

impl<R> Freeze for PoolHandle<R>

§

impl<R> !RefUnwindSafe for PoolHandle<R>

§

impl<R> Send for PoolHandle<R>

§

impl<R> Sync for PoolHandle<R>

§

impl<R> Unpin for PoolHandle<R>

§

impl<R> !UnwindSafe for PoolHandle<R>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.