Trait FromResidual
pub trait FromResidual<R = <Self as Try>::Residual>
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
fn from_residual(residual: R) -> SelfConstructs the type from a compatible
Residualtype.This should be implemented consistently with the
branchmethod 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
use ; assert_eq!; assert_eq!; assert_eq!;
Implementors
impl<B, C> FromResidual<ControlFlow<B, Infallible>> for ControlFlow<B, C>impl<T> FromResidual for NeverShortCircuit<T>impl<T> FromResidual<Option<Infallible>> for Option<T>impl<T> FromResidual<Yeet<()>> for Option<T>impl<T, E, F: From<E>> FromResidual<Result<Infallible, E>> for Poll<Option<Result<T, F>>>impl<T, E, F: From<E>> FromResidual<Result<Infallible, E>> for Poll<Result<T, F>>impl<T, E, F: ~const From<E>> FromResidual<Result<Infallible, E>> for Result<T, F>impl<T, E, F: ~const From<E>> FromResidual<Yeet<E>> for Result<T, F>