Closed dhardy closed 6 years ago
Note: those "impl" functions are modular on purpose; some flexibility is still needed.
Most likely Rng
will have a primary implementation in terms of just one of the Rng functions, but in several places it may be possible to write a more optimal implementation of another function using internal details (e.g. #36).
It could be an ergonomic win, but there are really not that many Rng
implementations. Is it worth the effort?
Edit: I see this bug is on reddit/r/rust. Not to discourage anyone. If this seems like a nice project, go for it! 😃
https://github.com/rust-lang-nursery/rand/pull/292 implements a less flexible derive, and may not get merged due to little use. There seems little incentive to develop more macros for this.
Is it possible to replace the functions in
rand_core::impls
with some kind of derive macros? E.g. it would be nice ifOsRng
could do something like follows (instead of this).Proceedural macros may already provide all we need for this? Also see the book article, and the procedural masquerade crate.