Module router

Source
Expand description

Perform routing between an input interface and a number number of outputs.

The Router is passed an algorithm that makes the decision about which egress port to send each routed object to.

§Ports

This component has the following ports:

§Function

The Router will take objects from the single input and send them to the correct output. A simplified summary of its functionality is:

loop {
    let value = rx.get()?.await;
    let tx_index = routing_algorithm.route(&value)?;

    match tx.get(tx_index) {
        None => {
            // Report error
        }
        Some(tx) => {
            tx.put(value)?.await;
        }
    }
}

Structs§

DefaultAlgorithm
Router

Traits§

Route
Trait required for routing algorithms to implement.