-
Notifications
You must be signed in to change notification settings - Fork 598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(corelib): OptionTrait::filter #7108
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r1.
Reviewable status: all files reviewed (commit messages unreviewed), 1 unresolved discussion (waiting on @hudem1)
corelib/src/option.cairo
line 808 at r1 (raw file):
} fn filter<P, +core::ops::FnOnce<P, (T,)>[Output: bool], +Drop<T>, +Drop<P>, +Copy<T>>(
Suggestion:
fn filter<P, +core::ops::FnOnce<P, (@T,)>[Output: bool], +Destruct<T>, +Destruct<P>>(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @orizi)
corelib/src/option.cairo
line 808 at r1 (raw file):
} fn filter<P, +core::ops::FnOnce<P, (T,)>[Output: bool], +Drop<T>, +Drop<P>, +Copy<T>>(
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @hudem1)
a discussion (no related file):
@gilbens-starkware
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! all files reviewed, all discussions resolved (waiting on @hudem1)
a discussion (no related file):
Previously, orizi wrote…
@ilyalesokhin-starkware for 2nd eye.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @hudem1)
I suggest the addition of
OptionTrait::filter
method that:returns [
None
] if the option is [None
], otherwise callspredicate
with the wrapped value and returns:Some(t)
] ifpredicate
returnstrue
(wheret
is the wrapped value)None
] ifpredicate
returnsfalse
.