Tracking Issue for smart pointer (try_)map (original) (raw)
Feature gate: #![feature(smart_pointer_try_map)]
This is a tracking issue for map and try_map functions for various smart pointer types, as per rust-lang/libs-team#364
Public API
// Taking T by value impl Box { fn map(this: Self, f: impl FnOnce(T) -> U) -> Box; fn try_map(this: Self, f: impl FnOnce(T) -> R) -> ChangeOutputType<R, Box<R::Output>> where R: Try, R::Residual: Residual<Box<R::Output, A>>; } impl UniqueRc { fn map(this: Self, f: impl FnOnce(T) -> U) -> UniqueRc; fn try_map(this: Self, f: impl FnOnce(T) -> R) -> ChangeOutputType<R, UniqueRc<R::Output>> where R: Try, R::Residual: Residual<UniqueRc<R::Output, A>>; } impl UniqueArc { fn map(this: Self, f: impl FnOnce(T) -> U) -> UniqueArc; fn try_map(this: Self, f: impl FnOnce(T) -> R) -> ChangeOutputType<R, UniqueArc<R::Output>> where R: Try, R::Residual: Residual<UniqueArc<R::Output, A>>; }
// Taking T by reference impl Rc { fn map(this: Self, f: impl FnOnce(&T) -> U) -> Rc; fn try_map(this: Self, f: impl FnOnce(&T) -> R) -> ChangeOutputType<R, Rc<R::Output>> where R: Try, R::Residual: Residual<Rc<R::Output, A>>; } impl Arc { fn map(this: Self, f: impl FnOnce(&T) -> U) -> Arc<; fn try_map(this: Self, f: impl FnOnce(&T) -> R) -> ChangeOutputType<R, Arc<<R::Output>> where R: Try, R::Residual: Residual<Arc<R::Output, A>>; }
Steps / History
(Remember to update the S-tracking-* label when checking boxes.)
- Implementation: smart pointer (try_)map #144420
- Final comment period (FCP)1
- Stabilization PR