From: Alexander van Ratingen <470642+alvra@users.noreply.github.com> Date: Thu, 21 Apr 2022 20:27:03 +0000 (+0200) Subject: Add readmes for all published crates. X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=cdf244ae18202ad3d4fd006c6478a9409b77defe;p=generate-random.git Add readmes for all published crates. --- diff --git a/derive-macro/README.md b/derive-macro/README.md new file mode 100644 index 0000000..f1dfc2e --- /dev/null +++ b/derive-macro/README.md @@ -0,0 +1,3 @@ +# Generate-Random-Macro + +This crate provides the derive macro for the main crate (`generate-random`). diff --git a/lib/README.md b/lib/README.md new file mode 100644 index 0000000..c2458ae --- /dev/null +++ b/lib/README.md @@ -0,0 +1,29 @@ +# Generate-Random + +Generate random data. + +## Example + +```rust +use generate_random::GenerateRandom; + +#[derive(GenerateRandom)] +enum MyEnum { + A, + C(bool), + B { + x: u8, + }, + // Providing a weight allows changing the probabilities. + // This variant is now twice as likely to be generated as the others. + #[weight(2)] + D, +} + +let mut rng = rand::thread_rng(); +let my_value = MyEnum::generate_random(&mut rng); +``` + +## Documentation + +[Documentation](https://lib.rs/crates/generate-random)