-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
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.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.
Description
Feature gate: #![feature(is_some_and)]
This is a tracking issue for Option::is_some_and
, Result::is_ok_and
and Result::is_err_and
.
Public API
impl<T> Option<T> {
pub fn is_some_and(self, f: impl FnOnce(T) -> bool) -> bool;
}
impl<T, E> Result<T, E> {
pub fn is_ok_and(self, f: impl FnOnce(T) -> bool) -> bool;
pub fn is_err_and(self, f: impl FnOnce(E) -> bool) -> bool;
}
Steps / History
- Lots of discussion and bikeshedding starting here: Tracking issue for
Option::contains
andResult::contains
#62358 (comment) - Implementation: Add Option::is_some_with and Result::is_{ok,err}_with #93051
- Rename: Rename is_{some,ok,err}_with to is_{some,ok,err}_and. #94765
- Take
self
by value: Changeis_some_and
to take by value #98354 - Final comment period (FCP)
- Stabilization PR: Stabilize is_some_and #110019
Unresolved Questions
- Naming. Alternatives:
is_some_with
/is_ok_with
/is_err_with
- ➡️
is_some_and
/is_ok_and
/is_err_and
contains
/contains_err
and_is
/and_err_is
is
has
- Take
self
or&self
?
ShadowJonathan, mormahr, JmPotato, hydra, dixslyf and 109 morearniu, stepancheg and kadiwa4socsteffahn and arniudrdavella, mxgrey, vrama628 and MariaSolOsvrama628vrama628 and Rudxain
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.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.