Skip to content

Commit

Permalink
Fix compatibility of futures-util with futures 0.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Nemo157 committed Feb 4, 2020
1 parent b825f30 commit 4526392
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions futures-util/src/async_await/select_mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ use proc_macro_hack::proc_macro_hack;
#[doc(hidden)]
#[macro_export]
macro_rules! document_select_macro {
($select:item $select_biased:item) => {
// This branch is required for `futures 0.3.1`, from before select_biased was introduced
($select:item) => {
/// Polls multiple futures and streams simultaneously, executing the branch
/// for the future that finishes first. If multiple futures are ready,
/// one will be pseudo-randomly selected at runtime. Futures directly
Expand Down Expand Up @@ -154,6 +155,10 @@ macro_rules! document_select_macro {
/// more complex behavior such as timer resets or writing into the head of
/// a stream.
$select
};

($select:item $select_biased:item) => {
$crate::document_select_macro!($select);

/// Polls multiple futures and streams simultaneously, executing the branch
/// for the future that finishes first. Unlike [`select!`], if multiple futures are ready,
Expand Down Expand Up @@ -302,7 +307,7 @@ macro_rules! document_select_macro {
///
/// [`select!`]: macro.select.html
$select_biased
}
};
}

document_select_macro! {
Expand Down

0 comments on commit 4526392

Please sign in to comment.