Feature gate: #![feature(try_trait_v2_residual)]
This is a tracking issue for the ops::Residual trait. cc rust-lang/rfcs#3721
This is used by try_* APIs that need to change from one member of a family to another, such as
For example, the closure passed to Iterator::try_find returns Foo<bool>, but the method wants to be able to return Foo<Option<<Self as Iterator>::Item>>.
Public API
// ops::Residual
trait Residual<O> {
type TryTrait: Try<Output = O, Residual = Self>;
}
// with implementations for `Result`, `Option`, and `ControlFlow`.
Steps / History
Unresolved Questions
Feature gate:
#![feature(try_trait_v2_residual)]This is a tracking issue for the
ops::Residualtrait. cc rust-lang/rfcs#3721This is used by
try_*APIs that need to change from one member of a family to another, such astry_array_from_fn#89379array::try_map#79711For example, the closure passed to
Iterator::try_findreturnsFoo<bool>, but the method wants to be able to returnFoo<Option<<Self as Iterator>::Item>>.Public API
Steps / History
array::{try_from_fn, try_map}andIterator::try_findgeneric overTry#91286Unresolved Questions
Try::Residualis renamed (an open question in Tracking Issue fortry_trait_v2, A new design for the?desugaring (RFC#3058) #84277), this this probably should be too.