Files
tuwunel/src/core/utils/option.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

12 lines
298 B
Rust
Raw Normal View History

use futures::future::OptionFuture;
pub trait OptionExt<T> {
fn map_async<O: Future, F: FnOnce(T) -> O>(self, f: F) -> OptionFuture<O>;
}
impl<T> OptionExt<T> for Option<T> {
fn map_async<O: Future, F: FnOnce(T) -> O>(self, f: F) -> OptionFuture<O> {
OptionFuture::<_>::from(self.map(f))
}
}