Skip to main content

IntoResult

Trait IntoResult 

Source
pub trait IntoResult {
    type Ok;

    // Required method
    fn into_result(self) -> Result<Self::Ok>;
}
Expand description

A closure’s return value: a tree T, or a Result<T>. So transform closures may return an array directly (|x: &Array| x.multiply(x).sum(..)) or a Result (with ? inside).

The associated type makes inference unambiguous: a closure returning Result<Array> has Ok = Array, never Ok = Result<Array> (Result is not a tree).

Required Associated Types§

Source

type Ok

The value.

Required Methods§

Source

fn into_result(self) -> Result<Self::Ok>

The value, or the closure’s error.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T: Tree> IntoResult for T

Source§

type Ok = T

Source§

impl<T> IntoResult for Result<T>

Source§

type Ok = T