Tracking Issue for smart pointer (try_)map
Open
Nobody has claimed this yet.
C-tracking-issue
S-tracking-blocked
T-libs
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
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<T> {
fn map<U>(this: Self, f: impl FnOnce(T) -> U) -> Box<U>;
fn try_map<R>(this: Self, f: impl FnOnce(T) -> R) -> ChangeOutputType<R, Box<R::Output>>
where
R: Try,
R::Residual: Residual<Box<R::Output, A>>;
}
impl UniqueRc<T> {
fn map<U>(this: Self, f: impl FnOnce(T) -> U) -> UniqueRc<U>;
fn try_map<R>(this: Self, f: impl FnOnce(T) -> R) -> ChangeOutputType<R, UniqueRc<R::Output>>
where
R: Try,
R::Residual: Residual<UniqueRc<R::Output, A>>;
}
impl UniqueArc<T> {
fn map<U>(this: Self, f: impl FnOnce(T) -> U) -> UniqueArc<U>;
fn try_map<R>(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<T> {
fn map<U>(this: Self, f: impl FnOnce(&T) -> U) -> Rc<U>;
fn try_map<R>(this: Self, f: impl FnOnce(&T) -> R) -> ChangeOutputType<R, Rc<R::Output>>
where
R: Try,
R::Residual: Residual<Rc<R::Output, A>>;
}
impl Arc<T> {
fn map<U>(this: Self, f: impl FnOnce(&T) -> U) -> Arc<<U>;
fn try_map<R>(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: #144420
- Final comment period (FCP)^1
- Stabilization PR
Unresolved Questions
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the public API listed in this issue and implementation PR #144420, then review the unresolved question linked from the issue. The remaining work is the final comment period and stabilization PR; done means the API has completed that stabilization process.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100