[][src]Struct async_nursery::Nursery

pub struct Nursery<S, Out> { /* fields omitted */ }

The sender part of the nursery. Wraps an unbounded sender. Can be cloned. To manage the spawned tasks and await their output, see NurseryStream.

Will disconnect on drop. You can close all senders by calling close_nursery.

Methods

impl<S, Out> Nursery<S, Out>[src]

pub fn new(spawner: S) -> (Self, NurseryStream<Out>) where
    Out: 'static, 
[src]

Create a new nursery. Returns a tuple of the sender part and the stream of outputs.

pub fn close_nursery(&self)[src]

Stop this nursery and any clones from accepting any more tasks. Calling this or dropping all Nursery is necessary for the stream impl of NurseryStream to end and return None.

Trait Implementations

impl<S, Out> Clone for Nursery<S, Out> where
    S: Clone
[src]

impl<S: Debug, Out: Debug> Debug for Nursery<S, Out>[src]

impl<S, Out> LocalNurse<Out> for Nursery<S, Out> where
    S: LocalSpawnHandle<Out>,
    Out: 'static, 
[src]

impl<S> LocalSpawn for Nursery<S, ()> where
    S: LocalSpawnHandle<()>, 
[src]

impl<S, Out> Nurse<Out> for Nursery<S, Out> where
    S: SpawnHandle<Out>,
    Out: 'static + Send
[src]

impl<S, Out> Sink<FutureObj<'static, Out>> for Nursery<S, Out> where
    S: SpawnHandle<Out>,
    Out: 'static + Send
[src]

type Error = NurseErr

The type of value produced by the sink when an error occurs.

fn poll_close(
    self: Pin<&mut Self>,
    _cx: &mut Context
) -> Poll<Result<(), Self::Error>>
[src]

This is a no-op. If you want to disconnect, just drop this Nursery. If you want to close the NurseryStream, call Nursery::close_nursery.

impl<S, Out> Sink<LocalFutureObj<'static, Out>> for Nursery<S, Out> where
    S: LocalSpawnHandle<Out>,
    Out: 'static, 
[src]

type Error = NurseErr

The type of value produced by the sink when an error occurs.

fn poll_close(
    self: Pin<&mut Self>,
    _cx: &mut Context
) -> Poll<Result<(), Self::Error>>
[src]

This is a no-op. If you want to disconnect, just drop this Nursery. If you want to close the NurseryStream, call Nursery::close_nursery.

impl<S> Spawn for Nursery<S, ()> where
    S: SpawnHandle<()>, 
[src]

Auto Trait Implementations

impl<S, Out> !RefUnwindSafe for Nursery<S, Out>

impl<S, Out> Send for Nursery<S, Out> where
    Out: Send,
    S: Send

impl<S, Out> Sync for Nursery<S, Out> where
    Out: Send,
    S: Sync

impl<S, Out> Unpin for Nursery<S, Out> where
    S: Unpin

impl<S, Out> !UnwindSafe for Nursery<S, Out>

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<Sp> LocalSpawnExt for Sp where
    Sp: LocalSpawn + ?Sized
[src]

impl<T, Item> SinkExt<Item> for T where
    T: Sink<Item> + ?Sized
[src]

impl<Sp> SpawnExt for Sp where
    Sp: Spawn + ?Sized
[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.