Skip to content

Commit

Permalink
Support fixed seed (#131)
Browse files Browse the repository at this point in the history
Allow default() when there is neither runtime nor compile time rngs.

Co-authored-by: Tom Kaitchuck <tkaitchuck@users.noreply.github.com>
  • Loading branch information
emilk and tkaitchuck committed Oct 25, 2022
1 parent 8eeeabc commit 8174160
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/rust.yml
Expand Up @@ -32,6 +32,11 @@ jobs:
with:
command: test
args: --no-default-features --features compile-time-rng
- name: check fixed-seed
uses: actions-rs/cargo@v1
with:
command: check
args: --no-default-features --features std
- name: check
uses: actions-rs/cargo@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Expand Up @@ -10,7 +10,7 @@
//! aHash is not a cryptographically secure hash.
//!
#![cfg_attr(
any(feature = "compile-time-rng", feature = "runtime-rng"),
feature = "std",
doc = r##"
# Example
```
Expand Down
4 changes: 1 addition & 3 deletions src/random_state.rs
Expand Up @@ -212,7 +212,6 @@ impl fmt::Debug for RandomState {
impl RandomState {
/// Use randomly generated keys
#[inline]
#[cfg(any(feature = "compile-time-rng", feature = "runtime-rng"))]
pub fn new() -> RandomState {
let src = get_src();
let fixed = get_fixed_seeds();
Expand Down Expand Up @@ -296,7 +295,6 @@ impl RandomState {
}
}

#[cfg(any(feature = "compile-time-rng", feature = "runtime-rng"))]
impl Default for RandomState {
#[inline]
fn default() -> Self {
Expand All @@ -313,7 +311,7 @@ impl BuildHasher for RandomState {
/// will generate the same hashes for the same input data.
///
#[cfg_attr(
any(feature = "compile-time-rng", feature = "runtime-rng"),
feature = "std",
doc = r##" # Examples
```
use ahash::{AHasher, RandomState};
Expand Down

0 comments on commit 8174160

Please sign in to comment.