Struct glommio::sync::Gate[][src]

pub struct Gate { /* fields omitted */ }

Facility to achieve graceful shutdown by waiting for the dependent tasks to complete.

Implementations

impl Gate[src]

pub fn new() -> Self[src]

Create a new Gate

pub fn enter(&self) -> Result<Pass, GlommioError<()>>[src]

Get a visitor pass which will be waited to be released on closing

pub fn spawn<T: 'static>(
    &self,
    future: impl Future<Output = T> + 'static
) -> Result<Task<T>, GlommioError<()>>
[src]

Spawn a task for which the gate will wait on closing into the current task queue.

pub fn spawn_into<T: 'static>(
    &self,
    future: impl Future<Output = T> + 'static,
    handle: TaskQueueHandle
) -> Result<Task<T>, GlommioError<()>>
[src]

Spawn a task for which the gate will wait on closing

pub async fn close(&self) -> Result<(), GlommioError<()>>[src]

Close the gate, and wait for all spawned tasks to complete

pub fn is_open(&self) -> bool[src]

Whether the gate is open or not

Trait Implementations

impl Clone for Gate[src]

impl Debug for Gate[src]

Auto Trait Implementations

impl !RefUnwindSafe for Gate

impl !Send for Gate

impl !Sync for Gate

impl Unpin for Gate

impl !UnwindSafe for Gate

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.