- Notifications
You must be signed in to change notification settings - Fork 14k
Open
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
Feature gate: #![feature(option_reduce)]
This is a tracking issue for Option::reduce, which combines two Options into one if both are Some, otherwise choosing the one that's Some or returning None.
Public API
impl<T> Option<T> { fn reduce<U, R, F>(self, other: Option<U>, f: F) -> Option<R> where T: Into<R>, U: Into<R>, F: FnOnce(T, U) -> R, { match (self, other) { (Some(a), Some(b)) => Some(f(a, b)), (Some(a), _) => Some(a.into()), (_, Some(b)) => Some(b.into()), _ => None, } } }Steps / History
(Remember to update the S-tracking-* label when checking boxes.)
- Implementation: add Option::reduce #144274
- Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- Will this cause inference problems? ACP: Add Option::reduce libs-team#609 (comment)
Footnotes
camsteffen and ArhanChaudhary
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.