Add ReadyBoolExt special case for ReadyEqExt.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2025-12-01 06:30:07 +00:00
parent 50bfb0fe5e
commit 1ce3d2b01f
5 changed files with 29 additions and 9 deletions

View File

@@ -2,6 +2,7 @@ mod bool_ext;
mod ext_ext;
mod option_ext;
mod option_stream;
mod ready_bool_ext;
mod ready_eq_ext;
mod try_ext_ext;
@@ -10,6 +11,7 @@ pub use self::{
ext_ext::ExtExt,
option_ext::OptionExt,
option_stream::OptionStream,
ready_bool_ext::ReadyBoolExt,
ready_eq_ext::ReadyEqExt,
try_ext_ext::TryExtExt,
};

View File

@@ -0,0 +1,18 @@
#![allow(clippy::wrong_self_convention)]
use futures::Future;
use super::ReadyEqExt;
pub trait ReadyBoolExt
where
Self: Future<Output = bool> + ReadyEqExt<bool> + Send,
{
#[inline]
fn is_false(self) -> impl Future<Output = bool> + Send { self.eq(&false) }
#[inline]
fn is_true(self) -> impl Future<Output = bool> + Send { self.eq(&true) }
}
impl<Fut> ReadyBoolExt for Fut where Fut: Future<Output = bool> + Send {}