Add ReadyBoolExt special case for ReadyEqExt.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -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,
|
||||
};
|
||||
|
||||
18
src/core/utils/future/ready_bool_ext.rs
Normal file
18
src/core/utils/future/ready_bool_ext.rs
Normal 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 {}
|
||||
Reference in New Issue
Block a user