Skip to content

Conversation

cuviper
Copy link
Member

@cuviper cuviper commented Aug 31, 2022

arrays<N>() works like chunks(N) without remainder, and yielding [Item; N] rather than allocated Vec<Item>.

There's no sequential precedent for this yet, but it's proposed in itertools#549. It may also be useful in places that would want Itertools::tuples (#971), because arrays are a first-class alternative to homogeneous tuples.

src/iter/mod.rs Outdated
/// the remaining items are ignored.
///
/// See also [`par_array_chunks()`] and [`par_array_chunks_mut()`] for similar
/// behavior on slices, although they yield array references instead.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reference depends on #789.

@cuviper cuviper marked this pull request as draft August 31, 2022 19:14
@cuviper
Copy link
Member Author

cuviper commented Sep 6, 2022

I missed that the standard library now has an unstable Iterator::array_chunks -- rust-lang/rust#100450.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant