From c34e31741d5a807ad82f730d83292dc005a6073a Mon Sep 17 00:00:00 2001 From: Expyron Date: Fri, 29 Jan 2021 18:06:10 +0100 Subject: [PATCH] Allow v3, v4, v5 features on wasm32-unknown-unknown --- Cargo.toml | 2 ++ README.md | 7 +++++-- src/lib.rs | 36 +++--------------------------------- 3 files changed, 10 insertions(+), 35 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c06b27178..56c0572e4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -59,6 +59,7 @@ optional = true version = "0.2.0" [dependencies.md5] +default-features = false optional = true version = "0.7" @@ -68,6 +69,7 @@ optional = true version = "1.0.56" [dependencies.sha1] +default-features = false optional = true version = "0.6" diff --git a/README.md b/README.md index 8199d34c7..723e7cfe8 100644 --- a/README.md +++ b/README.md @@ -46,14 +46,17 @@ various pieces of functionality: * `serde` - adds the ability to serialize and deserialize a `Uuid` using the `serde` crate. -You need to enable one of the following Cargo features together with -`v3`, `v4` or `v5` feature if you're targeting `wasm32-unknown-unknown` target: +You need to enable one of the following Cargo features together with the +`v4` feature if you're targeting `wasm32-unknown-unknown` target: * `stdweb` - enables support for `OsRng` on `wasm32-unknown-unknown` via `stdweb` combined with `cargo-web` * `wasm-bindgen` - `wasm-bindgen` enables support for `OsRng` on `wasm32-unknown-unknown` via [`wasm-bindgen`] +Alternatively, you can provide a custom `getrandom` implementation yourself +via [`getrandom::register_custom_getrandom`](https://docs.rs/getrandom/0.2.2/getrandom/macro.register_custom_getrandom.html). + By default, `uuid` can be depended on with: ```toml diff --git a/src/lib.rs b/src/lib.rs index 8a344af62..929899096 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -156,41 +156,11 @@ mod serde_support; mod slog_support; #[cfg(test)] mod test_util; -#[cfg(all( - feature = "v3", - any( - not(target_arch = "wasm32"), - target_os = "wasi", - all( - target_arch = "wasm32", - any(feature = "stdweb", feature = "wasm-bindgen") - ) - ) -))] +#[cfg(feature = "v3")] mod v3; -#[cfg(all( - feature = "v4", - any( - not(target_arch = "wasm32"), - target_os = "wasi", - all( - target_arch = "wasm32", - any(feature = "stdweb", feature = "wasm-bindgen") - ) - ) -))] +#[cfg(feature = "v4")] mod v4; -#[cfg(all( - feature = "v5", - any( - not(target_arch = "wasm32"), - target_os = "wasi", - all( - target_arch = "wasm32", - any(feature = "stdweb", feature = "wasm-bindgen") - ) - ) -))] +#[cfg(feature = "v5")] mod v5; #[cfg(all(windows, feature = "winapi"))] mod winapi_support;