Trait Try

Source
pub trait Try {
    type Output;
    type WithOutput<T>: Try;

    // Required method
    fn from_output(output: Self::Output) -> Self;
}
Expand description

Equivalent of core::ops::Try that doesn’t require nightly and allows changing the output type using a GAT.

Automatically implemented for Option and Result<T, E>. (Logically depends on core::ops::Try, but doesn’t have an explicit dependency as it’s unstable).

Required Associated Types§

Required Methods§

Source

fn from_output(output: Self::Output) -> Self

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> Try for Option<T>

Source§

type Output = T

Source§

type WithOutput<U> = Option<U>

Source§

fn from_output(output: Self::Output) -> Self

Source§

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

Source§

type Output = T

Source§

type WithOutput<U> = Result<U, E>

Source§

fn from_output(output: Self::Output) -> Self

Implementors§