Skip to content

Instantly share code, notes, and snippets.

@gauravssnl
Forked from carllerche/infinityc.rs
Created August 31, 2022 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gauravssnl/a7981a18b2cfef00d3cf2cb0fb94c6a6 to your computer and use it in GitHub Desktop.
Save gauravssnl/a7981a18b2cfef00d3cf2cb0fb94c6a6 to your computer and use it in GitHub Desktop.
#[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