Skip to main content

BoolExt

Trait BoolExt 

Source
pub trait BoolExt {
Show 23 methods // Required methods fn and<T>(self, t: Option<T>) -> Option<T>; fn and_is(self, b: bool) -> bool; fn and_if<F: FnOnce() -> bool>(self, f: F) -> bool; fn and_then<T, F: FnOnce() -> Option<T>>(self, f: F) -> Option<T>; fn clone_or<T: Clone>(self, err: T, t: &T) -> T; fn copy_or<T: Copy>(self, err: T, t: T) -> T; fn expect(self, msg: &str) -> Self; fn expect_false(self, msg: &str) -> Self; fn into_option(self) -> Option<()>; fn into_result(self) -> Result<(), ()>; fn is_false(&self) -> Self; fn map<T, F: FnOnce(Self) -> T>(self, f: F) -> T where Self: Sized; fn map_ok_or<T, E, F: FnOnce() -> T>(self, err: E, f: F) -> Result<T, E>; fn map_or<T, F: FnOnce() -> T>(self, err: T, f: F) -> T; fn map_or_else<T, E: FnOnce() -> T, F: FnOnce() -> T>( self, err: E, f: F, ) -> T; fn ok_or<E>(self, err: E) -> Result<(), E>; fn ok_or_else<E, F: FnOnce() -> E>(self, err: F) -> Result<(), E>; fn or<T, F: FnOnce() -> T>(self, f: F) -> Option<T>; fn or_some<T>(self, t: T) -> Option<T>; fn then_async<O: Future, F: FnOnce() -> O>(self, f: F) -> OptionFuture<O>; fn then_none<T>(self) -> Option<T>; fn then_ok_or<T, E>(self, t: T, e: E) -> Result<T, E>; fn then_ok_or_else<T, E, F: FnOnce() -> E>(self, t: T, e: F) -> Result<T, E>;
}
Expand description

Boolean extensions and chain.starters

Required Methods§

Source

fn and<T>(self, t: Option<T>) -> Option<T>

Source

fn and_is(self, b: bool) -> bool

Source

fn and_if<F: FnOnce() -> bool>(self, f: F) -> bool

Source

fn and_then<T, F: FnOnce() -> Option<T>>(self, f: F) -> Option<T>

Source

fn clone_or<T: Clone>(self, err: T, t: &T) -> T

Source

fn copy_or<T: Copy>(self, err: T, t: T) -> T

Source

fn expect(self, msg: &str) -> Self

Source

fn expect_false(self, msg: &str) -> Self

Source

fn into_option(self) -> Option<()>

Source

fn into_result(self) -> Result<(), ()>

Source

fn is_false(&self) -> Self

Source

fn map<T, F: FnOnce(Self) -> T>(self, f: F) -> T
where Self: Sized,

Source

fn map_ok_or<T, E, F: FnOnce() -> T>(self, err: E, f: F) -> Result<T, E>

Source

fn map_or<T, F: FnOnce() -> T>(self, err: T, f: F) -> T

Source

fn map_or_else<T, E: FnOnce() -> T, F: FnOnce() -> T>(self, err: E, f: F) -> T

Source

fn ok_or<E>(self, err: E) -> Result<(), E>

Source

fn ok_or_else<E, F: FnOnce() -> E>(self, err: F) -> Result<(), E>

Source

fn or<T, F: FnOnce() -> T>(self, f: F) -> Option<T>

Source

fn or_some<T>(self, t: T) -> Option<T>

Source

fn then_async<O: Future, F: FnOnce() -> O>(self, f: F) -> OptionFuture<O>

Source

fn then_none<T>(self) -> Option<T>

Source

fn then_ok_or<T, E>(self, t: T, e: E) -> Result<T, E>

Source

fn then_ok_or_else<T, E, F: FnOnce() -> E>(self, t: T, e: F) -> Result<T, E>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl BoolExt for bool

Source§

fn and<T>(self, t: Option<T>) -> Option<T>

Source§

fn and_if<F: FnOnce() -> Self>(self, f: F) -> Self

Source§

fn and_is(self, b: Self) -> Self

Source§

fn and_then<T, F: FnOnce() -> Option<T>>(self, f: F) -> Option<T>

Source§

fn clone_or<T: Clone>(self, err: T, t: &T) -> T

Source§

fn copy_or<T: Copy>(self, err: T, t: T) -> T

Source§

fn expect(self, msg: &str) -> Self

Source§

fn expect_false(self, msg: &str) -> Self

Source§

fn into_option(self) -> Option<()>

Source§

fn into_result(self) -> Result<(), ()>

Source§

fn is_false(&self) -> Self

Source§

fn map<T, F: FnOnce(Self) -> T>(self, f: F) -> T
where Self: Sized,

Source§

fn map_ok_or<T, E, F: FnOnce() -> T>(self, err: E, f: F) -> Result<T, E>

Source§

fn map_or<T, F: FnOnce() -> T>(self, err: T, f: F) -> T

Source§

fn map_or_else<T, E: FnOnce() -> T, F: FnOnce() -> T>(self, err: E, f: F) -> T

Source§

fn ok_or<E>(self, err: E) -> Result<(), E>

Source§

fn ok_or_else<E, F: FnOnce() -> E>(self, err: F) -> Result<(), E>

Source§

fn or<T, F: FnOnce() -> T>(self, f: F) -> Option<T>

Source§

fn or_some<T>(self, t: T) -> Option<T>

Source§

fn then_async<O: Future, F: FnOnce() -> O>(self, f: F) -> OptionFuture<O>

Source§

fn then_none<T>(self) -> Option<T>

Source§

fn then_ok_or<T, E>(self, t: T, e: E) -> Result<T, E>

Source§

fn then_ok_or_else<T, E, F: FnOnce() -> E>(self, t: T, e: F) -> Result<T, E>

Implementors§