Skip to content

Commit ccb59ce

Browse files
EFanZhtaiki-e
authored andcommitted
Implement Default trait for OptionFuture (#2471)
This provides an easy way to create empty `OptionFuture`s.
1 parent a74e4e5 commit ccb59ce

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

futures-util/src/future/option.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ pin_project! {
3131
}
3232
}
3333

34+
impl<F> Default for OptionFuture<F> {
35+
fn default() -> Self {
36+
Self { inner: None }
37+
}
38+
}
39+
3440
impl<F: Future> Future for OptionFuture<F> {
3541
type Output = Option<F::Output>;
3642

0 commit comments

Comments
 (0)