mirror of
https://github.com/uuid-rs/uuid.git
synced 2025-09-30 14:31:03 +00:00
fix up feature selection
This commit is contained in:
parent
406fb23317
commit
1ed9390699
10
Cargo.toml
10
Cargo.toml
@ -71,8 +71,8 @@ v8 = []
|
|||||||
js = ["dep:wasm-bindgen"]
|
js = ["dep:wasm-bindgen"]
|
||||||
|
|
||||||
rng = ["dep:getrandom"]
|
rng = ["dep:getrandom"]
|
||||||
rng-getrandom = ["rng", "dep:uuid-getrandom-internal"]
|
rng-getrandom = ["rng", "dep:getrandom", "dep:uuid-rng-internal", "uuid-rng-internal/getrandom"]
|
||||||
rng-rand = ["rng-getrandom", "dep:rand"]
|
rng-rand = ["rng", "dep:rand", "dep:uuid-rng-internal", "uuid-rng-internal/rand"]
|
||||||
|
|
||||||
fast-rng = ["rng", "dep:rand"]
|
fast-rng = ["rng", "dep:rand"]
|
||||||
|
|
||||||
@ -132,9 +132,9 @@ default-features = false
|
|||||||
version = "0.3"
|
version = "0.3"
|
||||||
optional = true
|
optional = true
|
||||||
|
|
||||||
[target.'cfg(all(target_arch = "wasm32", target_vendor = "unknown", target_os = "unknown"))'.dependencies.uuid-getrandom-internal]
|
[target.'cfg(all(target_arch = "wasm32", target_vendor = "unknown", target_os = "unknown"))'.dependencies.uuid-rng-internal]
|
||||||
version = "1.12.1"
|
version = "1.12.1"
|
||||||
path = "getrandom"
|
path = "rng"
|
||||||
optional = true
|
optional = true
|
||||||
|
|
||||||
# Private
|
# Private
|
||||||
@ -198,7 +198,7 @@ version = "1"
|
|||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
"macros",
|
"macros",
|
||||||
"getrandom",
|
"rng",
|
||||||
"examples",
|
"examples",
|
||||||
"tests/smoke-test",
|
"tests/smoke-test",
|
||||||
"tests/wasm32-getrandom-test",
|
"tests/wasm32-getrandom-test",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "uuid-getrandom-internal"
|
name = "uuid-rng-internal"
|
||||||
version = "1.12.1"
|
version = "1.12.1"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
authors = [
|
authors = [
|
||||||
@ -19,3 +19,8 @@ license = "Apache-2.0 OR MIT"
|
|||||||
# Forces a dependency on `getrandom`
|
# Forces a dependency on `getrandom`
|
||||||
[dependencies.getrandom]
|
[dependencies.getrandom]
|
||||||
version = "0.3"
|
version = "0.3"
|
||||||
|
optional = true
|
||||||
|
|
||||||
|
[dependencies.rand]
|
||||||
|
version = "0.9"
|
||||||
|
optional = true
|
@ -12,5 +12,9 @@
|
|||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub mod __private {
|
pub mod __private {
|
||||||
pub use getrandom::*;
|
#[cfg(feature = "getrandom")]
|
||||||
|
pub use getrandom;
|
||||||
|
|
||||||
|
#[cfg(feature = "rand")]
|
||||||
|
pub use rand;
|
||||||
}
|
}
|
12
src/rng.rs
12
src/rng.rs
@ -115,15 +115,15 @@ mod imp {
|
|||||||
#[cfg(feature = "rng-rand")]
|
#[cfg(feature = "rng-rand")]
|
||||||
impl Rng for RngImp {
|
impl Rng for RngImp {
|
||||||
fn u128() -> u128 {
|
fn u128() -> u128 {
|
||||||
rand::random()
|
uuid_rng_internal::__private::rand::random()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn u64() -> u64 {
|
fn u64() -> u64 {
|
||||||
rand::random()
|
uuid_rng_internal::__private::rand::random()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn u16() -> u16 {
|
fn u16() -> u16 {
|
||||||
rand::random()
|
uuid_rng_internal::__private::rand::random()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ mod imp {
|
|||||||
fn u128() -> u128 {
|
fn u128() -> u128 {
|
||||||
let mut bytes = [0u8; 16];
|
let mut bytes = [0u8; 16];
|
||||||
|
|
||||||
uuid_getrandom_internal::__private::fill(&mut bytes).unwrap_or_else(|err| {
|
uuid_rng_internal::__private::getrandom::fill(&mut bytes).unwrap_or_else(|err| {
|
||||||
// NB: getrandom::Error has no source; this is adequate display
|
// NB: getrandom::Error has no source; this is adequate display
|
||||||
panic!("could not retrieve random bytes for uuid: {}", err)
|
panic!("could not retrieve random bytes for uuid: {}", err)
|
||||||
});
|
});
|
||||||
@ -147,7 +147,7 @@ mod imp {
|
|||||||
fn u64() -> u64 {
|
fn u64() -> u64 {
|
||||||
let mut bytes = [0u8; 8];
|
let mut bytes = [0u8; 8];
|
||||||
|
|
||||||
uuid_getrandom_internal::__private::fill(&mut bytes).unwrap_or_else(|err| {
|
uuid_rng_internal::__private::getrandom::fill(&mut bytes).unwrap_or_else(|err| {
|
||||||
// NB: getrandom::Error has no source; this is adequate display
|
// NB: getrandom::Error has no source; this is adequate display
|
||||||
panic!("could not retrieve random bytes for uuid: {}", err)
|
panic!("could not retrieve random bytes for uuid: {}", err)
|
||||||
});
|
});
|
||||||
@ -158,7 +158,7 @@ mod imp {
|
|||||||
fn u16() -> u16 {
|
fn u16() -> u16 {
|
||||||
let mut bytes = [0u8; 2];
|
let mut bytes = [0u8; 2];
|
||||||
|
|
||||||
uuid_getrandom_internal::__private::fill(&mut bytes).unwrap_or_else(|err| {
|
uuid_rng_internal::__private::getrandom::fill(&mut bytes).unwrap_or_else(|err| {
|
||||||
// NB: getrandom::Error has no source; this is adequate display
|
// NB: getrandom::Error has no source; this is adequate display
|
||||||
panic!("could not retrieve random bytes for uuid: {}", err)
|
panic!("could not retrieve random bytes for uuid: {}", err)
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user