macro_rules! select {
(
$($name:pat = $top:expr => $bottom:expr), +$(,)?
) => { ... };
}
Expand description
macro used to select for only one event it will return the index of which event happens first for example:
use cogo::{chan, select};
let (s, r) = chan!();
s.send(1);
select! {
rv = r.recv() => {
println!("{:?}",rv);
},
Ok(msg) = r.try_recv() => {
println!("{}",msg);
}
};