From 1fd8c82dcd123a6d161cf660a8dbe201959295fc Mon Sep 17 00:00:00 2001 From: ad hoc Date: Tue, 17 Jan 2023 11:02:00 +0100 Subject: [PATCH] add is_some and is_none to OptionFuture --- futures-util/src/future/option.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/futures-util/src/future/option.rs b/futures-util/src/future/option.rs index 0bc377758a..e124b67327 100644 --- a/futures-util/src/future/option.rs +++ b/futures-util/src/future/option.rs @@ -62,3 +62,15 @@ impl From> for OptionFuture { Self { inner: option } } } + +impl OptionFuture { + /// Returns `true` if the future is present. + pub fn is_some(&self) -> bool { + self.inner.is_some() + } + + /// Returns `true` if the future is absent. + pub fn is_node(&self) -> bool { + self.inner.is_none() + } +}