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

Use IntoIterator instead of slices #111

Closed
hellow554 opened this issue Dec 6, 2017 · 2 comments
Closed

Use IntoIterator instead of slices #111

hellow554 opened this issue Dec 6, 2017 · 2 comments

Comments

@hellow554
Copy link
Contributor

Wouldn't it be handy to accept an iterator instead of a slice? Maybe like:

fn read_u32<T: IntoIterator>(buf: &T) -> u32;
fn write_u32<T: IntoIterator>(buf: &mut T, n: u32);

Maybe if you really need the amount of items of T you may use ExactSizeIterator instead of plain IntoIterator.

@BurntSushi
Copy link
Owner

No, sorry, this doesn't work. A fast implementation needs a slice.

@hellow554
Copy link
Contributor Author

Alright, I can accept that argument ;)

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

2 participants