[][src]Struct rusty_junctions::channels::BidirChannel

pub struct BidirChannel<T, R> { /* fields omitted */ }

Synchronous, bidirectional message channel.

This channel type is characterized by both the argument and return type of its send_recv method. A message can be sent through this channel which will then also cause the channel to wait for a Join Pattern involving this channel to fire.

The subtle difference between using this channel type over a combination of a SendChannel and a RecvChannel is that this channel ensures that Messages necessary to perform the sending and receiving happen atomically together. In fact, only one Message is sent for both. Therefore, a call to send_recv can be viewed as an atomic operation, whereas a separate SendChannel::send and RecvChannel::recv may have an arbitrary amount of actions happen between them.

Sending a message on this channel will block the current thread until a Join Pattern that this channel is part of has fired.

Methods

impl<T, R> BidirChannel<T, R> where
    T: Any + Send,
    R: Any + Send
[src]

pub fn send_recv(&self, msg: T) -> Result<R, RecvError>[src]

Send a message and receive value generated by fired Junction.

Panics

Panics if it was not possible to send the given message and return Sender to the Junction.

Trait Implementations

impl<T: Clone, R: Clone> Clone for BidirChannel<T, R>[src]

Auto Trait Implementations

impl<T, R> !RefUnwindSafe for BidirChannel<T, R>

impl<T, R> Send for BidirChannel<T, R> where
    R: Send,
    T: Send

impl<T, R> !Sync for BidirChannel<T, R>

impl<T, R> Unpin for BidirChannel<T, R> where
    R: Unpin,
    T: Unpin

impl<T, R> !UnwindSafe for BidirChannel<T, 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> 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.