-
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): Felt252DictFromIterator #7137
feat(corelib): Felt252DictFromIterator #7137
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 1 of 2 files at r1, all commit messages.
Reviewable status: 1 of 2 files reviewed, 3 unresolved discussions (waiting on @julio4)
corelib/src/dict.cairo
line 270 at r1 (raw file):
T, +Destruct<T>, +Destruct<Felt252Dict<T>>, +Felt252DictValue<T>, > of crate::iter::FromIterator<Felt252Dict<T>, (felt252, T)> { /// Constructs a `Felt252Dict<T>` from an iterator of (felt252, T) key-value pairs.
also note that early repeating values are overriden.
additionally test this.
corelib/src/test/dict_test.cairo
line 156 at r1 (raw file):
.into_iter() .map(|x| (Into::<u32, felt252>::into(x), x)) .collect();
should work, at least if rebased.
Suggestion:
let mut dict: Felt252Dict<u32> = (0..5_u32).into_iter().map(|x| (x.into(), x)).collect();
corelib/src/test/dict_test.cairo
line 162 at r1 (raw file):
assert_eq!(@dict[2], @2); assert_eq!(@dict[3], @3); assert_eq!(@dict[4], @4);
Suggestion:
assert_eq!(dict[0], 0);
assert_eq!(dict[1], 1);
assert_eq!(dict[2], 2);
assert_eq!(dict[3], 3);
assert_eq!(dict[4], 4);
64d1fec
to
87a443a
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 r2, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @julio4)
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: 1 of 2 files reviewed, all discussions resolved (waiting on @orizi)
corelib/src/dict.cairo
line 270 at r1 (raw file):
Previously, orizi wrote…
also note that early repeating values are overriden.
additionally test this.
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 1 of 1 files at r3, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @julio4)
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 @julio4)
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.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @julio4)
Implement
iter::FromIterator<Felt252Dict<T>, (felt252, T)>
Constructs a
Felt252Dict<T>
from an iterator of (felt252, T) key-value pairs.Example