pub trait ResultExt<T, E> {
// Required methods
fn ok_checked<EE: EqType<E>>(self) -> Option<T>;
fn err_checked<TT: EqType<T>>(self) -> Option<E>;
}
Expand description
An extension trait adding functionality to Result
.
Required Methods§
Sourcefn ok_checked<EE: EqType<E>>(self) -> Option<T>
fn ok_checked<EE: EqType<E>>(self) -> Option<T>
Like Result::ok
, but the caller must provide the error type being
discarded.
This allows code to be written which will stop compiling if a result’s error type changes in the future.
Sourcefn err_checked<TT: EqType<T>>(self) -> Option<E>
fn err_checked<TT: EqType<T>>(self) -> Option<E>
Like Result::err
, but the caller must provide the ok type being
discarded.
This allows code to be written which will stop compiling if a result’s ok type changes in the future.
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.