Skip to content

Commit

Permalink
Implement futures::stream::FusedStream for receiver types
Browse files Browse the repository at this point in the history
Makes it possible to use receiver types together with the `futures::select!` macro.
  • Loading branch information
phil-opp committed Sep 14, 2021
1 parent 8ae5936 commit e6370da
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions zenoh-util/src/sync/channel.rs
Expand Up @@ -91,6 +91,13 @@ macro_rules! zreceiver{
}
}

impl$(<$( $lt ),+>)? futures::stream::FusedStream for $struct_name$(<$( $lt ),+>)? {
#[inline(always)]
fn is_terminated(&self) -> bool {
self.stream.is_terminated()
}
}

impl $struct_name$(<$( $lt ),+>)? {
#[inline(always)]
pub fn iter(&self) -> Iter<'_, $recv_type> {
Expand Down

0 comments on commit e6370da

Please sign in to comment.