pub trait Try: Sized {
type Output;
type Residual;
// Required method
fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
}Expand description
Splitting an expression into a success value or an early-exit residual.
Required Associated Types§
Sourcetype Residual
type Residual
The residual type passed to FromResidual::from_residual on early exit.
Required Methods§
Sourcefn branch(self) -> ControlFlow<Self::Residual, Self::Output>
fn branch(self) -> ControlFlow<Self::Residual, Self::Output>
Splits self into either a continuation output or an early-exit residual.
Following RFC 3058, this returns ControlFlow which has identical ABI
and zero-cost machine representation to Result while cleanly modeling
early returns for non-error types like Option and Poll.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".