Skip to main content

taxi_cab/
taxi-cab.rs

1// The only struct that needs to be brought into score is the Junction itself.
2use rusty_junctions::Junction;
3
4fn main() {
5    // Create a new Junction.
6    let j = Junction::new();
7
8    // Create new channels on the Junction j.
9    let name = j.send_channel::<String>();
10    let value = j.send_channel::<i32>();
11
12    // Declare a new Join Pattern on the Junction using the channels above.
13    j.when(&name).and(&value).then_do(|n, v| { println!("{} {}", n, v); });
14
15    // Send all the required messages for the Join Pattern above to fire.
16    value.send(1729).unwrap();
17    name.send(String::from("Taxi")).unwrap();
18}