Trait core::ops::FromResidual
source · pub trait FromResidual<R = <Self as Try>::Residual> {
// Required method
fn from_residual(residual: R) -> Self;
}
🔬This is a nightly-only experimental API. (
try_trait_v2
#84277)Expand description
Used to specify which residuals can be converted into which crate::ops::Try
types.
Every Try
type needs to be recreatable from its own associated
Residual
type, but can also have additional FromResidual
implementations
to support interconversion with other Try
types.
Required Methods§
sourcefn from_residual(residual: R) -> Self
🔬This is a nightly-only experimental API. (try_trait_v2
#84277)
fn from_residual(residual: R) -> Self
try_trait_v2
#84277)Constructs the type from a compatible Residual
type.
This should be implemented consistently with the branch
method such
that applying the ?
operator will get back an equivalent residual:
FromResidual::from_residual(r).branch() --> ControlFlow::Break(r)
.
(The residual is not mandated to be identical when interconversion is involved.)
§Examples
Object Safety§
This trait is not object safe.