[][src]Struct ipc_orchestrator::IpcReceiver

pub struct IpcReceiver<T> { /* fields omitted */ }

Receiving end of a channel using serialized messages.

Examples

Blocking IO

let response = rx.recv().unwrap();
println!("Received data...");

Non-blocking IO

loop {
    match rx.try_recv() {
        Ok(res) => {
            // Do something interesting wth your result
            println!("Received data...");
            break;
        },
        Err(_) => {
            // Do something else useful while we wait
            println!("Still waiting...");
        }
    }
}

Embedding Receivers

let (tx, rx) = ipc::channel().unwrap();
let (embedded_tx, embedded_rx) = ipc::channel().unwrap();
// Send the IpcReceiver
tx.send(embedded_rx).unwrap();
// Receive the sent IpcReceiver
let received_rx = rx.recv().unwrap();
// Receive any data sent to the received IpcReceiver
let rx_data = received_rx.recv().unwrap();

Implementation details

Each IpcReceiver is backed by the OS specific implementations of OsIpcReceiver.

Methods

impl<T> IpcReceiver<T> where
    T: Deserialize<'de> + Serialize
[src]

pub fn recv(&self) -> Result<T, Box<ErrorKind>>[src]

Blocking receive.

pub fn try_recv(&self) -> Result<T, Box<ErrorKind>>[src]

Non-blocking receive

pub fn to_opaque(self) -> OpaqueIpcReceiver[src]

Erase the type of the channel.

Useful for adding routes to a RouterProxy.

Trait Implementations

impl<T> Debug for IpcReceiver<T> where
    T: Debug
[src]

impl<'de, T> Deserialize<'de> for IpcReceiver<T>[src]

impl<T> Serialize for IpcReceiver<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for IpcReceiver<T>

impl<T> Send for IpcReceiver<T> where
    T: Send

impl<T> !Sync for IpcReceiver<T>

impl<T> Unpin for IpcReceiver<T> where
    T: Unpin

impl<T> UnwindSafe for IpcReceiver<T> where
    T: UnwindSafe

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> DeserializeOwned for T where
    T: Deserialize<'de>, 
[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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,