-
Notifications
You must be signed in to change notification settings - Fork 2
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
Should there be a fill_bytes
method in addition to try_fill
?
#12
Comments
I wrote a comment about why I believe cryptographic code wants
|
Personally I would like to see both a fallible and infallible version One extra method does not cost us much. PRNG implementations are slightly simpler. Wrappers would have to wrap one extra method. And fallible RNGs would need one extra method that unwraps
For me, anything that returns a Result causes me to think about how it should be dealt with. Is unwrapping and panicing ok? Should the error be passed on? Or is it something that can be handled somehow? So while there is no performance overhead, there is a little mental overhead. But this is not a point I want to push to far. Performance is not a real problem as the RFC notes, as any (external) RNG that can error has enough overhead to it for the unwrap not to matter. And PRNGs should be inlinable. Should we also have |
Well reasoned argument. Having both On the other hand, adding |
Thank you. Yes, I am not proposing |
Part of the RFC about default implementations:
I completely agree about no default implementations for An Rng implementation generally has an I didn't think about wrappers, and that is especially a strong argument against default implementations. Do the same arguments apply for a default implementation of
I do not like it, but with the wrapper argument And as the RFC notes, no default implementations is not a big problem. There are not all that many implementors of |
This is merged into upstream master and appears to be well received |
Relevant part of the RFC:
The text was updated successfully, but these errors were encountered: