Skip to content

Commit

Permalink
Implement Default trait for OptionFuture (#2471)
Browse files Browse the repository at this point in the history
This provides an easy way to create empty `OptionFuture`s.
  • Loading branch information
EFanZh committed Aug 5, 2021
1 parent 633a905 commit 62d5aa5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions futures-util/src/future/option.rs
Expand Up @@ -31,6 +31,12 @@ pin_project! {
}
}

impl<F> Default for OptionFuture<F> {
fn default() -> Self {
Self { inner: None }
}
}

impl<F: Future> Future for OptionFuture<F> {
type Output = Option<F::Output>;

Expand Down

0 comments on commit 62d5aa5

Please sign in to comment.