Skip to content

Implement std::io::Read for RngCore #434

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

Merged
merged 2 commits into from
May 8, 2018

Conversation

pitdicker
Copy link
Contributor

We once played with the idea of having an implementation of std::io::Read for Rng #254, and that it could live in the read module #366 (comment).

I don't think it needs a wrapper type, as we can simply implement it for RngCore. Then the natural place would be in rand_core, so no need to preserve the read module.

This is not a very exiting PR in my opinion, I just wanted to test if it was necessary to keep the read module around. Just as well make a PR then.

@dhardy
Copy link
Member

dhardy commented May 8, 2018

cc @sdleffler
@burdges do you see any problems with this? I can't think of any.

@burdges
Copy link
Contributor

burdges commented May 8, 2018

It's fine afaik but I've forgotten any concerns from before.

Copy link
Member

@dhardy dhardy left a comment

Choose a reason for hiding this comment

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

Well, looks okay to me. It's a shame our error codes don't map very well to io::ErrorKind, but I have no suggestions to improve that.

@pitdicker
Copy link
Contributor Author

I don't worry too much about our error codes not mapping nicely to IO errors. Seems like a common problem for all library-specific errors.

@pitdicker pitdicker merged commit 9728648 into rust-random:master May 8, 2018
@pitdicker pitdicker deleted the std_io_read branch May 8, 2018 21:20
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.

3 participants