pub trait FallbackExt<T, E> {
// Required methods
fn or_fallback(self, fallback: T) -> Result<T, E>;
fn or_fallback_with<F: FnOnce() -> T>(self, f: F) -> Result<T, E>;
}Expand description
Extension trait for adding fallback behavior to Results.
Required Methods§
Sourcefn or_fallback(self, fallback: T) -> Result<T, E>
fn or_fallback(self, fallback: T) -> Result<T, E>
Return a fallback value if this result is an error.
Sourcefn or_fallback_with<F: FnOnce() -> T>(self, f: F) -> Result<T, E>
fn or_fallback_with<F: FnOnce() -> T>(self, f: F) -> Result<T, E>
Return a fallback value computed by a function if this result is an error.
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.