pub struct IpcReceiver<T> { /* private fields */ }
Expand description

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

Implementations

Blocking receive.

Non-blocking receive

Blocks for up to the specified duration attempting to receive a message.

This may block for longer than the specified duration if the channel is busy. If your timeout exceeds the duration that your operating system can represent in milliseconds, this may block forever. At the time of writing, the smallest duration that may trigger this behavior is over 24 days.

Erase the type of the channel.

Useful for adding routes to a RouterProxy.

Trait Implementations

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.