Trait core::ops::Residual

source ·
pub trait Residual<O> {
    type TryType: Try<Output = O, Residual = Self>;
}
🔬This is a nightly-only experimental API. (try_trait_v2_residual #91285)
Expand description

允许检索实现 Try 的规范类型,该类型具有此类型作为它的残差,并允许它保留 O 作为它的输出。

如果您将 Try trait 视为将类型拆分为其 Try::OutputTry::Residual 组件,则可以将它们重新组合在一起。

例如,Result<T, E>: Try<Output = T, Residual = Result<Infallible, E>>,在另一个方向上,<Result<Infallible, E> as Residual<T>>::TryType = Result<T, E>

Required Associated Types§

source

type TryType: Try<Output = O, Residual = Self>

🔬This is a nightly-only experimental API. (try_trait_v2_residual #91285)

此元函数的 “return” 类型。

Implementors§

source§

impl<B, C> Residual<C> for ControlFlow<B, Infallible>

§

type TryType = ControlFlow<B, C>

source§

impl<T> Residual<T> for Option<Infallible>

§

type TryType = Option<T>

source§

impl<T, E> Residual<T> for Result<Infallible, E>

§

type TryType = Result<T, E>