-
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
Add rand-core sub-crate and update version numbers #288
Conversation
dhardy
commented
Mar 8, 2018
•
edited
Loading
edited
- This moves core traits/types/impls to rand-core
- impls and le modules are now public (from rand-core only)
- CI tweaks, needed since not all features are duplicated on rand-core
- Cross-crate doc links now use full URLs (is there a better option?); I should note @burdges predicted this would be an issue; also we can't really test the links until after publication
Looks good to me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Left a few small comments.
rand-core/README.md
Outdated
Core functionality for the [rand] library. | ||
|
||
This crate contains the core trait, `RngCore`, and some extension traits. This | ||
should be sufficient for libraries publishing an `RngCore` implementation, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reads a like a suggestion, but we prefer RNG implementations to only depend on this crate, right? Can you reword a little?
`rand` is primarily distributed under the terms of both the MIT | ||
license and the Apache License (Version 2.0). | ||
|
||
See LICENSE-APACHE, and LICENSE-MIT for details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the license files (and the changelog) also be copied to the rand-core
directory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know, but that appears necessary to get the licence files inside the Cargo package, so I will add them.
rand-core/src/lib.rs
Outdated
//! | ||
//! The `impls` and `le` sub-modules include a few small functions to assist | ||
//! implementation of `RngCore`. Since this module is only of interest to | ||
//! `RngCore` implementors, it is not re-exported from `rand`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Old comment?
rand-core/src/lib.rs
Outdated
/// | ||
/// This trait encapsulates the low-level functionality common to all | ||
/// generators, and is the "back end", to be implemented by generators. | ||
/// End users should normally use [`Rng`] instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds like an old comment. Maybe point to the rand
crate now, instead of only the Rng
trait. (also in the rest of this comment block)
rand-core/src/lib.rs
Outdated
/// This trait encapsulates the low-level functionality common to all | ||
/// pseudo-random number generators (PRNGs, or algorithmic generators). | ||
/// | ||
/// Normally users should use the [`NewRng`] extension trait, excepting when a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe point to rand
?
/// | ||
/// Seeding a small PRNG from another small PRNG is possible, but | ||
/// something to be careful with. An extreme example of how this can go | ||
/// wrong is seeding an [`XorShiftRng`] from another [`XorShiftRng`], which |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still want this link to XorShiftRng
? I removed it in the original PR because of the crate separation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to keep this paragraph as is since it provides a clear warning and only mentions Xorshift as an example (we could even remove the link and it would still be clear).
This does leave a couple of cross-crate doc links, but I don't see a major problem (as long as we keep the number small).
Is now the right time to bring up if we should remove the default implementations in b.t.w. I upgraded my |
Agreed, default implementations is an issue to discuss. I'd like to try implementing some type of Okay, I'll go over the documentation again. |
This moves core traits/types/impls to rand-core impls and le modules are now public (from rand-core only) CI tweaks, needed since not all features are duplicated on rand-core Cross-crate doc links now use full URLs (is there a better option?)
Updated. Are you happy with this @pitdicker? The update adds two unrelated changes which might want extra attention:
|
Yes I am happy with it 😄, and very nice documentation. Ready to merge? |
Good! But no, I'm hoping to get a little more feedback on #291 first. |
Rebased without change from #291. |
Add rand-core sub-crate and update version numbers