-
-
Save gauravssnl/a7981a18b2cfef00d3cf2cb0fb94c6a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[macro_export] | |
macro_rules! select { | |
// Done normalizing | |
(@ { $($t:tt)* }) => { | |
$crate::select_imp!( $($t)* ) | |
}; | |
(@ { $($t:tt)* } $b:pat = $f:expr => $h:block $($r:tt)* ) => { | |
$crate:select!(@{ $($t)* $b = $f => $h, } $($r)*) | |
}; | |
( $($t:tt)* ) => { | |
$crate::select!(@{} $($t:tt)*) | |
} | |
} | |
#[macro_export] | |
macro_rules! select_imp { | |
( | |
$( $bind:pat = $fut:expr => $handle:expr , )+ | |
) => { | |
}; | |
} | |
fn main() { | |
select! { | |
foo = delay().await => { | |
println!("DELAY!"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment