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

Collect into array #1005

Open
axelkar opened this issue Dec 14, 2024 · 2 comments
Open

Collect into array #1005

axelkar opened this issue Dec 14, 2024 · 2 comments

Comments

@axelkar
Copy link
Contributor

axelkar commented Dec 14, 2024

It'd be really useful since generic tuples aren't out yet

@jakoritarleite
Copy link
Contributor

I think it may only be possible if you're using ExactSizeIterator, because we need to know the exact size at compile time.

@jswrenn
Copy link
Member

jswrenn commented Dec 16, 2024

There's a lot of edge cases to work through with this feature, which is why it's not stable in the standard library yet.

In the meantime, you can use array::from_fn to achieve this, by calling iter.next().unwrap() in the passed closure.

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

No branches or pull requests

3 participants