-
Notifications
You must be signed in to change notification settings - Fork 432
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
Single error type #768
Comments
I think we already ruled out option 2? So, in my opinion, if we unify the error types, we should choose a variant of 1, and minimise breakage (which probably means 1b). The next question should be do we want to unify the error types? My main concern here is breakage, though considering the current |
I will try to draft approach 1 then. 1b may feel a bit weird for RNG implementations, as e.g. on Linux |
Are there good alternatives? Doing as you suggest and making An alternative would be to make the However, it may be that the best option is to have an independent |
Hm, so we have to choose between duplication of The problem with feature-gating |
Then it sounds like we're agreed that duplication of error code is the best option, thus leaving us the question of whether and how to revise the Note that if we make the two behave identically we can still merge the types in the future — in fact, we could make |
Looks like there is another reason not to do unification: |
To me it seems best to have two error types, and maybe provide |
Agreed. We need |
Currently we have two error types:
getrandom::Error
andrand_core::Error
. To simplify things a bit it was proposed to leave only one error type. It can be done using one of the following approaches:rand_core
usesgetrandom::Error
:1a)
getradom
is an optional dependency andtry_fill_bytes
is feature-gate behindgetrandom
feature.1b)
getrandom
is a mandatoryrand_core
dependency.1c) Introduce additional feature gate for
try_fill_bytes
which will enablegetrandom
.getrandom
depends onrand_core
, we changerand_core::Error
definition togetrandom::Error
.rand_error
or something.Of course we also can leave everything as-is. Personally I am inclined towards variant 1a, since we already plan to use
getrandom
forSeedableRng
.Thoughts?
The text was updated successfully, but these errors were encountered: