Skip to content
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): ByteArrayFromIterator #7130

Merged

Conversation

julio4
Copy link
Contributor

@julio4 julio4 commented Jan 21, 2025

Implement iter::FromIterator<ByteArray, u8>

Example

let iter = array!['h', 'e', 'l', 'l', 'o'].into_iter();
let ba: ByteArray = FromIterator::from_iter(iter);
assert_eq!(ba, "hello");

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Collaborator

@orizi orizi left a 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, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @julio4)


a discussion (no related file):
@gilbens-starkware for 2nd eye.


corelib/src/test/byte_array_test.cairo line 498 at r1 (raw file):

fn test_from_iterator() {
    let ba: ByteArray = FromIterator::from_iter(array!['h', 'e', 'l', 'l', 'o'].into_iter());
    assert_eq!(ba, "hello");

Suggestion:

    let ba: ByteArray = array!['h', 'e', 'l', 'l', 'o'].into_iter().collect();
    assert_eq!(ba, "hello");

@julio4 julio4 force-pushed the feat/byte_array_from_iter branch from 58fae1f to 72acf02 Compare January 22, 2025 09:39
Copy link
Contributor Author

@julio4 julio4 left a 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/test/byte_array_test.cairo line 498 at r1 (raw file):

fn test_from_iterator() {
    let ba: ByteArray = FromIterator::from_iter(array!['h', 'e', 'l', 'l', 'o'].into_iter());
    assert_eq!(ba, "hello");

Done.

Copy link
Collaborator

@orizi orizi left a 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: :shipit: complete! all files reviewed, all discussions resolved (waiting on @julio4)

@gilbens-starkware gilbens-starkware added this pull request to the merge queue Jan 22, 2025
Merged via the queue into starkware-libs:main with commit b69fd61 Jan 22, 2025
47 checks passed
@julio4 julio4 deleted the feat/byte_array_from_iter branch January 22, 2025 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants