Conversation
FromBytes::getrandom method gatedFromBytes::getrandom method
|
@joshlf |
|
Apologies for the radio silence. Right now all of our effort is going into #671. At some point we do want to figure out a unified strategy for how to support integrations with other crates, but we're not going to have the cycles to do that work until 0.8 has been released. This PR on its own is obviously reasonable, but we want to be careful about how to expose APIs like these so we don't lock ourselves into supporting API patterns that we later want to walk back, and so we want to make sure we've thought through the whole design space before we publish even a simple API like this one. TLDR: We're interested in something like this, but it will likely be quite some time before we are able to move forward on it. |
The method is gated on the disabled by default
getrandomfeature.This PR is an alternative to rust-random/getrandom#381.
Reasons for why it could be better to add this method to
zerocopyinstead of introducing thegetrandom::valuefunction:getrandomhas lower MSRV thanzerocopy.getrandomdoes not have plans for breaking releases in the near future, whilezerocopyhas.u32::getrandom(), whilegetrandom::value()may require explicit type ascription.zerocopylooks like a better place for keepingunsafecode for transforming (random) bytes to a value ofFromBytestype.getrandom::Error,zerocopywill not have any types fromgetrandomin its public API, whilegetrandomwould always rely onFromBytesbound in its public API.