[][src]Struct scambio::Left

pub struct Left<L, R> { /* fields omitted */ }

An exchange endpoint for value transfers.

Every exchange consists of two halves, Left and Right, which can transfer data between each other one by one. At most one data item is stored per endpoint half.

Implementations

impl<L, R> Left<L, R>[src]

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

Has the other end been dropped?

pub async fn send<'_>(&'_ mut self, value: L) -> Result<(), L>[src]

Send a value to Right.

If Right has been dropped, the value will be returned.

pub async fn receive<'_>(&'_ mut self) -> Option<R>[src]

Receive a value from Right.

If Right has been dropped, None will be returned.

pub fn poll_receive(&mut self, cx: &mut Context) -> Poll<Option<R>>[src]

Receive a value from Right if available.

If Right has been dropped, Poll::Ready(None) will be returned. If no value is available, Poll::Pending will be returned and Left will be woken up once a value can be received for Right.

pub fn poll_send_ready(&mut self, cx: &mut Context) -> Poll<()>[src]

Check if there is capacity to send a data item to Right.

pub fn send_now(&mut self, value: L) -> Result<(), Error<L>>[src]

Try to send data to Right.

If Right has been dropped or there is already a pending data item for Right the data will be returned to the caller.

Use Left::poll_send_ready to ensure there is capacity available.

Trait Implementations

impl<L, R> Debug for Left<L, R>[src]

impl<L, R> Drop for Left<L, R>[src]

impl<L, R> Unpin for Left<L, R>[src]

Auto Trait Implementations

impl<L, R> !RefUnwindSafe for Left<L, R>

impl<L, R> Send for Left<L, R> where
    L: Send,
    R: Send

impl<L, R> Sync for Left<L, R> where
    L: Send,
    R: Send

impl<L, R> !UnwindSafe for Left<L, R>

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, 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.