-
-
Notifications
You must be signed in to change notification settings - Fork 2
Let RngCore: TryRngCore<Error = Infallible>
#45
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
Conversation
|
Updated. Some things need further discussion (see above). |
RngCore: TryRngCoreRngCore: TryRngCore<Error = Infallible>
This fixes changes made in #2195 This is due to the refactor made in rand_core in rust-random/rand_core#45 which dropped the "trait dependency" between CryptoRng and RngCore
|
We noticed something a little weird here:
So: pub trait CryptoRng: TryCryptoRng<Error = Infallible> {}impl<R: TryRngCore<Error = Infallible>> RngCore for R { ...I would expect that means any type which impls |
|
I guess we should revert my suggestion above and add a test for this. |
|
I don't get it... I tried to make a contrived version in the playground and it... works? |
CHANGELOG.mdentrySummary
Revise the core traits according to @newpavlov's suggestion and similar to #41 but keeping the infallible methods.
No trait renames are done in this PR. Also not sure if we need any.
Details
TryRngCoreis implemented for anyR: DerefMutwhereTarget: TryRngCore.RngCore: TryRngCore<Error = Infallible>with automatic implementation overTryRngCoreUnwrapMutis removedCryptoRng = RngCore + TryCryptoRngor as close as possible without sum traits; it is kept since I believe some people needdyn CryptoRngutils::{next_u64_via_u32, next_word_via_fill}now use closures instead ofR: RngCoreQuestions
Should
utilsfns support potentially-fallible uses (try_next_u64_via_u32takesFnMut() -> Result<u32; E>for genericE)? I think unnecessary.