Skip to main content

Try

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<T> 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".

Implementations on Foreign Types§

Source§

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

Available on crate feature nightly only.
Source§

type Output = T

Source§

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

Source§

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

Source§

impl<T> Try for Option<T>

Available on crate feature nightly only.
Source§

type Output = T

Source§

type WithOutput<U> = Option<U>

Source§

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

Implementors§