Skip to main content

BoolExt

Trait BoolExt 

Source
pub trait BoolExt
where Self: Future<Output = bool> + Send,
{ // Required methods fn or<B>(self, b: B) -> impl Future<Output = bool> + Send where B: Future<Output = bool> + Send + Unpin, Self: Sized + Unpin; fn and<B>(self, b: B) -> impl Future<Output = bool> + Send where B: Future<Output = bool> + Send, Self: Sized; fn and2<B, C>(self, b: B, c: C) -> impl Future<Output = bool> + Send where B: Future<Output = bool> + Send, C: Future<Output = bool> + Send, Self: Sized; fn and3<B, C, D>( self, b: B, c: C, d: D, ) -> impl Future<Output = bool> + Send where B: Future<Output = bool> + Send, C: Future<Output = bool> + Send, D: Future<Output = bool> + Send, Self: Sized; }
Expand description

Combines Boolean futures with concurrent short-circuit logic.

Conjunction resolves false on the first false output and true only after every input resolves true. Disjunction resolves true on the first true output and false only after every input resolves false.

Required Methods§

Source

fn or<B>(self, b: B) -> impl Future<Output = bool> + Send
where B: Future<Output = bool> + Send + Unpin, Self: Sized + Unpin,

Computes the disjunction of two Boolean futures.

Both futures are polled concurrently. The returned future resolves true on the first true output or false after both produce false.

Source

fn and<B>(self, b: B) -> impl Future<Output = bool> + Send
where B: Future<Output = bool> + Send, Self: Sized,

Computes the conjunction of two Boolean futures.

Both futures are polled concurrently. The returned future resolves false on the first false output or true after both produce true.

Source

fn and2<B, C>(self, b: B, c: C) -> impl Future<Output = bool> + Send
where B: Future<Output = bool> + Send, C: Future<Output = bool> + Send, Self: Sized,

Computes the conjunction of three Boolean futures.

The receiver and both arguments are polled concurrently. The result is true only when all three futures produce true.

Source

fn and3<B, C, D>(self, b: B, c: C, d: D) -> impl Future<Output = bool> + Send
where B: Future<Output = bool> + Send, C: Future<Output = bool> + Send, D: Future<Output = bool> + Send, Self: Sized,

Computes the conjunction of four Boolean futures.

The receiver and all three arguments are polled concurrently. The result is true only when every future produces true.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<Fut> BoolExt for Fut
where Fut: Future<Output = bool> + Send,