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

Return io::Result<usize> instead of io::Result<()> #6

Closed
nox opened this issue Jan 28, 2017 · 0 comments
Closed

Return io::Result<usize> instead of io::Result<()> #6

nox opened this issue Jan 28, 2017 · 0 comments

Comments

@nox
Copy link
Contributor

nox commented Jan 28, 2017

There is no way to know how many bytes were written in the result, which is a problem when using write with a stack-allocated array. Returning io::Result<usize> would allow this:

let mut buf = [b'\0'; 20];
let len = itoa::write(&mut buf, value)?;
let result = &buf[0..len];
dtolnay added a commit that referenced this issue Jan 28, 2017
Return the number of bytes written from itoa::write (fixes #6)
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

1 participant