Sender

Struct Sender 

Source
pub struct Sender<T: Send + 'static, E: Send + 'static> { /* private fields */ }
Expand description

The sending half of Stream::pair(). Can only be owned by a single task at a time.

Implementations§

Source§

impl<T: Send + 'static, E: Send + 'static> Sender<T, E>

Source

pub fn send(self, val: T) -> BusySender<T, E>

Attempts to send a value to its Stream. Consumes self and returns a future representing the operation completing successfully and interest in the next value being expressed.

Source

pub fn fail(self, err: E)

Terminated the stream with the given error.

Source

pub fn abort(self)

Fails the paired Stream with a cancellation error. This will eventually go away when carllerche/syncbox#10 lands. It is currently needed to keep the state correct (see async::sequence)

Source

pub fn send_all<S: Source<Value = T>>( self, src: S, ) -> Future<Self, (S::Error, Self)>

Send + ’static all the values in the given source

Trait Implementations§

Source§

impl<T: Send + 'static, E: Send + 'static> Async for Sender<T, E>

Source§

type Value = Sender<T, E>

Source§

type Error = ()

Source§

type Cancel = Receipt<Sender<T, E>>

Source§

fn is_ready(&self) -> bool

Returns true if expect will succeed.
Source§

fn is_err(&self) -> bool

Returns true if the async value is ready and has failed
Source§

fn poll(self) -> Result<AsyncResult<Sender<T, E>, ()>, Sender<T, E>>

Get the underlying value if present
Source§

fn ready<F: FnOnce(Sender<T, E>) + Send + 'static>( self, f: F, ) -> Receipt<Sender<T, E>>

Invokes the given function when the Async instance is ready to be consumed.
Source§

fn expect(self) -> AsyncResult<Self::Value, Self::Error>

Get the underlying value if present, panic otherwise
Source§

fn receive<F>(self, f: F)
where F: FnOnce(AsyncResult<Self::Value, Self::Error>) + Send + 'static,

Invoke the callback with the resolved Async result.
Source§

fn await(self) -> AsyncResult<Self::Value, Self::Error>

Blocks the thread until the async value is complete and returns the result.
Source§

fn fire(self)

Trigger the computation without waiting for the result
Source§

fn and<U: Async<Error = Self::Error>>( self, next: U, ) -> Future<U::Value, Self::Error>

This method returns a future whose completion value depends on the completion value of the original future. Read more
Source§

fn and_then<F, U: Async<Error = Self::Error>>( self, f: F, ) -> Future<U::Value, Self::Error>
where F: FnOnce(Self::Value) -> U + Send + 'static, U::Value: Send + 'static,

This method returns a future whose completion value depends on the completion value of the original future. Read more
Source§

fn or<A>(self, alt: A) -> Future<Self::Value, A::Error>
where A: Async<Value = Self::Value>,

This method returns a future whose completion value depends on the completion value of the original future. Read more
Source§

fn or_else<F, A>(self, f: F) -> Future<Self::Value, A::Error>
where F: FnOnce(Self::Error) -> A + Send + 'static, A: Async<Value = Self::Value>,

This method returns a future whose completion value depends on the completion value of the original future. Read more
Source§

impl<T: Send + 'static, E: Send + 'static> Cancel<Sender<T, E>> for Receipt<Sender<T, E>>

Source§

fn cancel(self) -> Option<Sender<T, E>>

Source§

impl<T: Send + 'static, E: Send + 'static> Debug for Sender<T, E>

Source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Send + 'static, E: Send + 'static> Drop for Sender<T, E>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<T, E> Freeze for Sender<T, E>

§

impl<T, E> !RefUnwindSafe for Sender<T, E>

§

impl<T, E> Send for Sender<T, E>

§

impl<T, E> !Sync for Sender<T, E>

§

impl<T, E> Unpin for Sender<T, E>

§

impl<T, E> !UnwindSafe for Sender<T, E>

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.