pub trait DefensiveResult<T, E> {
    fn defensive_map_err<F, O: FnOnce(E) -> F>(self, o: O) -> Result<T, F>;
    fn defensive_map_or_else<U, D: FnOnce(E) -> U, F: FnOnce(T) -> U>(
        default: D,
        f: F
    ) -> U; fn defensive_ok(self) -> Option<T>; fn defensive_map<U, F: FnOnce(T) -> U>(self, f: F) -> Result<U, E>; }
Expand description

Subset of methods similar to Defensive that can only work for a Result.

Required Methods

Defensively map the error into another return type, but you are really sure that this conversion should never be needed.

Defensively map and unpack the value to something else (U), or call the default callback if Err, which should never happen.

Defensively transform this result into an option, discarding the Err variant if it happens, which should never happen.

Exactly the same as map, but it prints the appropriate warnings if the value being mapped is Err.