Module task

Module task 

Source
Expand description

Task for remote execution

§Example

let (rx, tx) = Task::new().split();
 
// client side
tx_input1 = tx.clone();
tx_input2 = tx.clone();
let out1 = tx_input1.send("test input 1")?;
let out2 = tx_input2.send("test input 2")?;
 
// server side
if let Some(RemoteIO(input, tx_out)) = rx.recv().await {
    // compute with job input
    let output = compute_with(input)?;
    // send job output to client side
    tx_out.send(output)?;
} else {
    // task channel closed
    // ...
}

Structs§

RemoteIO
RemoteIO contains input and output for remote execution. The first field in tuple is job input, and the second is for writing job output.
Task
A Task channel for remote execution (multi-producer, single-consumer)
TaskReceiver
The server side for remote execution
TaskSender
The client side for remote execution

Type Aliases§

RxInput
The receiver of task for remote execution
TxOutput
The sender of computational results.