Skip to content

Commit

Permalink
Allow v3, v4, v5 features on wasm32-unknown-unknown
Browse files Browse the repository at this point in the history
  • Loading branch information
Expyron committed Jan 29, 2021
1 parent 805f4ed commit c34e317
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 35 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Expand Up @@ -59,6 +59,7 @@ optional = true
version = "0.2.0"

[dependencies.md5]
default-features = false
optional = true
version = "0.7"

Expand All @@ -68,6 +69,7 @@ optional = true
version = "1.0.56"

[dependencies.sha1]
default-features = false
optional = true
version = "0.6"

Expand Down
7 changes: 5 additions & 2 deletions README.md
Expand Up @@ -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
Expand Down
36 changes: 3 additions & 33 deletions src/lib.rs
Expand Up @@ -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;
Expand Down

0 comments on commit c34e317

Please sign in to comment.