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§
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) -> Twhere
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>
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.