-
Notifications
You must be signed in to change notification settings - Fork 540
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): Result iterator #6933
Conversation
1e6d1e9
to
9b67600
Compare
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
corelib/src/test/result_test.cairo
line 2 at r2 (raw file):
use crate::result::{Result, ResultTraitImpl}; use crate::iter::{IntoIterator, Iterator};
should this not be included automatically in the prelude?
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 all commit messages.
Reviewable status: 0 of 2 files reviewed, 3 unresolved discussions (waiting on @cairolover)
corelib/src/result.cairo
line 577 at r2 (raw file):
impl ResultIntoIterator<T, E, +Copy<T>, +Destruct<T>, +Destruct<E>> of IntoIterator<Result<T, E>> { type IntoIter = ResultIter<T>;
consider just using OptionIter
here after it is merged.
Suggestion:
impl ResultIntoIterator<T, E, +Copy<T>, +Destruct<T>, +Destruct<E>> of IntoIterator<Result<T, E>> {
type IntoIter = OptionIter<T>;
corelib/src/test/result_test.cairo
line 265 at r2 (raw file):
let x: Result<u32, ByteArray> = Result::Ok(5); let mut x_iter = x.into_iter(); assert!(x_iter.next() == Option::Some(5));
Suggestion:
assert!(x_iter.next() == Option::Some(5));
assert!(x_iter.next() == Option::None);
e39c3a0
to
3f8b3ff
Compare
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 3 files reviewed, 3 unresolved discussions (waiting on @orizi)
corelib/src/result.cairo
line 577 at r2 (raw file):
Previously, orizi wrote…
consider just using
OptionIter
here after it is merged.
Done.
corelib/src/test/result_test.cairo
line 265 at r2 (raw file):
let x: Result<u32, ByteArray> = Result::Ok(5); let mut x_iter = x.into_iter(); assert!(x_iter.next() == Option::Some(5));
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 all commit messages.
Reviewable status: 0 of 3 files reviewed, 4 unresolved discussions (waiting on @cairolover)
corelib/src/result.cairo
line 578 at r3 (raw file):
#[inline] fn into_iter(self: Result<T, E>) -> crate::option::OptionIter<T> { crate::option::OptionIter { inner: self.ok() }
and remove the pub(crate)
.
Suggestion:
self.ok().into_iter()
3f8b3ff
to
40e182a
Compare
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 3 of 3 files at r4, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @cairolover)
corelib/src/result.cairo
line 557 at r4 (raw file):
impl ResultIntoIterator< T, E, +Copy<T>, +Destruct<T>, +Destruct<E>,
I don't think this should be required.
Suggestion:
T, E, +Destruct<T>, +Destruct<E>,
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: 1 of 3 files reviewed, 2 unresolved discussions (waiting on @orizi)
corelib/src/result.cairo
line 578 at r3 (raw file):
Previously, orizi wrote…
and remove the
pub(crate)
.
Done.
corelib/src/result.cairo
line 557 at r4 (raw file):
Previously, orizi wrote…
I don't think this should be required.
Done.
29647f0
to
9ddac7a
Compare
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: 2 of 3 files reviewed, all discussions resolved (waiting on @cairolover)
a discussion (no related file):
@gilbens-starkware for 2nd eye.
9ddac7a
to
fafa451
Compare
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 r6, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @cairolover)
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 @cairolover)
a discussion (no related file):
Previously, orizi wrote…
@gilbens-starkware for 2nd eye.
ping
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 1 of 3 files at r4, 2 of 2 files at r6, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @cairolover)
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 1 of 1 files at r7, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @cairolover)
Adds
IntoIter
andIter
implementations forResult<T, E>
.Follows a format similar to
SpanIter
andArrayIter
, with a newResultIter
struct.