Skip to content

Commit

Permalink
refactor: Remove unneeded seed declaration from macro
Browse files Browse the repository at this point in the history
  • Loading branch information
Bluefinger committed May 21, 2024
1 parent fe69231 commit 583cc39
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 23 deletions.
3 changes: 0 additions & 3 deletions bevy_prng/src/chacha.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,20 @@ use bevy::prelude::{ReflectDeserialize, ReflectSerialize};
newtype_prng!(
ChaCha8Rng,
::rand_chacha::ChaCha8Rng,
[u8; 32],
"A newtyped [`rand_chacha::ChaCha8Rng`] RNG",
"rand_chacha"
);

newtype_prng!(
ChaCha12Rng,
::rand_chacha::ChaCha12Rng,
[u8; 32],
"A newtyped [`rand_chacha::ChaCha12Rng`] RNG",
"rand_chacha"
);

newtype_prng!(
ChaCha20Rng,
::rand_chacha::ChaCha20Rng,
[u8; 32],
"A newtyped [`rand_chacha::ChaCha20Rng`] RNG",
"rand_chacha"
);
4 changes: 2 additions & 2 deletions bevy_prng/src/newtype.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
macro_rules! newtype_prng {
($newtype:tt, $rng:ty, $seed:ty, $doc:tt, $feature:tt) => {
($newtype:tt, $rng:ty, $doc:tt, $feature:tt) => {
#[doc = $doc]
#[derive(Debug, Clone, PartialEq, Reflect)]
#[cfg_attr(
Expand Down Expand Up @@ -51,7 +51,7 @@ macro_rules! newtype_prng {
}

impl SeedableRng for $newtype {
type Seed = $seed;
type Seed = <$rng as SeedableRng>::Seed;

#[inline]
fn from_seed(seed: Self::Seed) -> Self {
Expand Down
3 changes: 0 additions & 3 deletions bevy_prng/src/pcg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,20 @@ use bevy::prelude::{ReflectDeserialize, ReflectSerialize};
newtype_prng!(
Pcg32,
::rand_pcg::Pcg32,
[u8; 16],
"A newtyped [`rand_pcg::Pcg32`] RNG",
"rand_pcg"
);

newtype_prng!(
Pcg64,
::rand_pcg::Pcg64,
[u8; 32],
"A newtyped [`rand_pcg::Pcg64`] RNG",
"rand_pcg"
);

newtype_prng!(
Pcg64Mcg,
::rand_pcg::Pcg64Mcg,
[u8; 16],
"A newtyped [`rand_pcg::Pcg64Mcg`] RNG",
"rand_pcg"
);
1 change: 0 additions & 1 deletion bevy_prng/src/wyrand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use bevy::prelude::{ReflectDeserialize, ReflectSerialize};
newtype_prng!(
WyRand,
::wyrand::WyRand,
[u8; 8],
"A newtyped [`wyrand::WyRand`] RNG",
"wyrand"
);
14 changes: 0 additions & 14 deletions bevy_prng/src/xoshiro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,111 +9,97 @@ use bevy::prelude::{ReflectDeserialize, ReflectSerialize};
newtype_prng!(
Xoshiro512StarStar,
::rand_xoshiro::Xoshiro512StarStar,
::rand_xoshiro::Seed512,
"A newtyped [`rand_xoshiro::Xoshiro512StarStar`] RNG",
"rand_xoshiro"
);

newtype_prng!(
Xoshiro512PlusPlus,
::rand_xoshiro::Xoshiro512PlusPlus,
::rand_xoshiro::Seed512,
"A newtyped [`rand_xoshiro::Xoshiro512PlusPlus`] RNG",
"rand_xoshiro"
);

newtype_prng!(
Xoshiro512Plus,
::rand_xoshiro::Xoshiro512Plus,
::rand_xoshiro::Seed512,
"A newtyped [`rand_xoshiro::Xoshiro512Plus`] RNG",
"rand_xoshiro"
);

newtype_prng!(
Xoshiro256StarStar,
::rand_xoshiro::Xoshiro256StarStar,
[u8; 32],
"A newtyped [`rand_xoshiro::Xoshiro256StarStar`] RNG",
"rand_xoshiro"
);

newtype_prng!(
Xoshiro256PlusPlus,
::rand_xoshiro::Xoshiro256PlusPlus,
[u8; 32],
"A newtyped [`rand_xoshiro::Xoshiro256PlusPlus`] RNG",
"rand_xoshiro"
);

newtype_prng!(
Xoshiro256Plus,
::rand_xoshiro::Xoshiro256Plus,
[u8; 32],
"A newtyped [`rand_xoshiro::Xoshiro256Plus`] RNG",
"rand_xoshiro"
);

newtype_prng!(
Xoroshiro128StarStar,
::rand_xoshiro::Xoroshiro128StarStar,
[u8; 16],
"A newtyped [`rand_xoshiro::Xoshiro128StarStar`] RNG",
"rand_xoshiro"
);

newtype_prng!(
Xoroshiro128PlusPlus,
::rand_xoshiro::Xoroshiro128PlusPlus,
[u8; 16],
"A newtyped [`rand_xoshiro::Xoshiro256PlusPlus`] RNG",
"rand_xoshiro"
);

newtype_prng!(
Xoroshiro128Plus,
::rand_xoshiro::Xoroshiro128Plus,
[u8; 16],
"A newtyped [`rand_xoshiro::Xoshiro128Plus`] RNG",
"rand_xoshiro"
);

newtype_prng!(
Xoshiro128StarStar,
::rand_xoshiro::Xoshiro128StarStar,
[u8; 16],
"A newtyped [`rand_xoshiro::Xoshiro128StarStar`] RNG",
"rand_xoshiro"
);

newtype_prng!(
Xoshiro128PlusPlus,
::rand_xoshiro::Xoshiro128PlusPlus,
[u8; 16],
"A newtyped [`rand_xoshiro::Xoshiro256PlusPlus`] RNG",
"rand_xoshiro"
);

newtype_prng!(
Xoshiro128Plus,
::rand_xoshiro::Xoshiro128Plus,
[u8; 16],
"A newtyped [`rand_xoshiro::Xoshiro128Plus`] RNG",
"rand_xoshiro"
);

newtype_prng!(
Xoroshiro64StarStar,
::rand_xoshiro::Xoroshiro64StarStar,
[u8; 8],
"A newtyped [`rand_xoshiro::Xoroshiro64StarStar`] RNG",
"rand_xoshiro"
);

newtype_prng!(
Xoroshiro64Star,
::rand_xoshiro::Xoroshiro64Star,
[u8; 8],
"A newtyped [`rand_xoshiro::Xoroshiro64Star`] RNG",
"rand_xoshiro"
);

0 comments on commit 583cc39

Please sign in to comment.