Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Looking through the wonderful review by @m-ou-se in m-ou-se#1, I realized that at some point we might need a separate API for generating hashmap seeds. This is because when generating a hashmap seed on Linux, we would not want to block waiting on the RNG to initialize.
However, if we decided to add a different source or configuration for the RNG one day, it wouldn't make sense to just have it be a free function in this crate. This is because with the addition of #291 (and potentially #293), we also use free functions to get the random bytes in different ways (fill a
&mut [u8]
, fill a&mut [MaybeUninit<u8>]
, return an array).This PR contains the proposed
Options
API:Options
would determine the RNG source/configuration.Options
would be used to get random bytes in different ways:fill
fill_uninit
array
(not in this PR, see Add Options::array method for creating random arrays #352 for how we might add it)Right now we only have a single option:
Options::DEFAULT
. However, in the future, we could addOptions
to:Not all of these are things we should necessarily do, but this gives
us the flexibility to add such options in the future.
Bikeshed: This enum could be called
Options
/Source
/Config
, it could also be an opaque struct at this point rather than an enum (as we only have one variant).Signed-off-by: Joe Richey [email protected]