pub trait BoolExt: Sized {
// Required methods
fn into_option(self) -> Option<()>;
fn into_result(self) -> Result<(), ()>;
// Provided methods
fn and<T>(self, option: Option<T>) -> Option<T> { ... }
fn and_then<T, F>(self, f: F) -> Option<T>
where F: FnOnce() -> Option<T> { ... }
fn then<T, F>(self, f: F) -> Option<T>
where F: FnOnce() -> T { ... }
fn then_ext<T, F>(self, f: F) -> Option<T>
where F: FnOnce() -> T { ... }
fn then_some<T>(self, value: T) -> Option<T> { ... }
fn then_some_ext<T>(self, value: T) -> Option<T> { ... }
fn ok_or<E>(self, error: E) -> Result<(), E> { ... }
fn ok_or_else<E, F>(self, f: F) -> Result<(), E>
where F: FnOnce() -> E { ... }
}
Required Methods§
fn into_option(self) -> Option<()>
fn into_result(self) -> Result<(), ()>
Provided Methods§
fn and<T>(self, option: Option<T>) -> Option<T>
fn and_then<T, F>(self, f: F) -> Option<T>
fn then<T, F>(self, f: F) -> Option<T>where
F: FnOnce() -> T,
fn then_ext<T, F>(self, f: F) -> Option<T>where
F: FnOnce() -> T,
fn then_some<T>(self, value: T) -> Option<T>
fn then_some_ext<T>(self, value: T) -> Option<T>
fn ok_or<E>(self, error: E) -> Result<(), E>
fn ok_or_else<E, F>(self, f: F) -> Result<(), E>where
F: FnOnce() -> 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.