explicit

Trait ResultExt

Source
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§

Source

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.

Source

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.

Implementations on Foreign Types§

Source§

impl<T, E> ResultExt<T, E> for Result<T, E>

Source§

fn ok_checked<EE: EqType<E>>(self) -> Option<T>

Source§

fn err_checked<TT: EqType<T>>(self) -> Option<E>

Implementors§