diff --git a/Cargo.toml b/Cargo.toml index b576b84..0488cc1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,6 +35,8 @@ wasi = "0.9" [features] std = [] +# Feature to enable fallback CPU-based implementation +cpu = [] # Feature to enable custom RNG implementations custom = [] # Unstable feature to support being a libstd dependency diff --git a/src/lib.rs b/src/lib.rs index a19ed71..db8665b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -185,6 +185,8 @@ cfg_if! { #[path = "rdrand.rs"] mod imp; } else if #[cfg(feature = "custom")] { use custom as imp; + } else if #[cfg(all(feature = "cpu", target_arch = "x86_64"))] { + #[path = "rdrand.rs"] mod imp; } else { compile_error!("\ target is not supported, for more information see: \