Tracking Issue for ops::Residual (feature try_trait_v2_residual) (original) (raw)
Feature gate: #![feature(try_trait_v2_residual)]
This is a tracking issue for the ops::Residual trait.
This is used by try_* APIs that need to change from one member of a family to another, such as
- https://doc.rust-lang.org/nightly/std/array/fn.try_from_fn.html Tracking issue for try_array_from_fn #89379
- https://doc.rust-lang.org/nightly/std/iter/trait.Iterator.html#method.try_find Tracking Issue for Iterator::try_find #63178
- https://doc.rust-lang.org/nightly/std/primitive.array.html#method.try_map Tracking issue for array::try_map #79711
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 { type TryTrait: Try<Output = O, Residual = Self>; }
// with implementations for Result, Option, and ControlFlow.
Steps / History
- Implementation: Make array::{try_from_fn, try_map} and Iterator::try_find generic over Try #91286
- Final comment period (FCP)
- Stabilization PR
Unresolved Questions
- If
Try::Residualis renamed (an open question in Tracking Issue for try_trait_v2, A new design for the ? desugaring (RFC#3058) #84277), this this probably should be too.