From 352b4e720e02455c3a13f9a87a01959429a6be79 Mon Sep 17 00:00:00 2001 From: Juniper Tyree Date: Thu, 11 Jan 2024 05:24:20 +0000 Subject: [PATCH] Add back missing Backup for SeaHash and WyHash rngs --- necsim/impls/no-std/src/cogs/rng/seahash.rs | 9 ++++++++- necsim/impls/no-std/src/cogs/rng/wyhash.rs | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/necsim/impls/no-std/src/cogs/rng/seahash.rs b/necsim/impls/no-std/src/cogs/rng/seahash.rs index 1da7d2e9a..93cc87ecd 100644 --- a/necsim/impls/no-std/src/cogs/rng/seahash.rs +++ b/necsim/impls/no-std/src/cogs/rng/seahash.rs @@ -1,6 +1,6 @@ use core::marker::PhantomData; -use necsim_core::cogs::{MathsCore, PrimeableRng, RngCore}; +use necsim_core::cogs::{Backup, MathsCore, PrimeableRng, RngCore}; use serde::{Deserialize, Serialize}; @@ -17,6 +17,13 @@ pub struct SeaHash { marker: PhantomData, } +#[contract_trait] +impl Backup for SeaHash { + unsafe fn backup_unchecked(&self) -> Self { + self.clone() + } +} + impl RngCore for SeaHash { type Seed = [u8; 8]; diff --git a/necsim/impls/no-std/src/cogs/rng/wyhash.rs b/necsim/impls/no-std/src/cogs/rng/wyhash.rs index eae21264c..c4fdeed68 100644 --- a/necsim/impls/no-std/src/cogs/rng/wyhash.rs +++ b/necsim/impls/no-std/src/cogs/rng/wyhash.rs @@ -1,6 +1,6 @@ use core::marker::PhantomData; -use necsim_core::cogs::{MathsCore, PrimeableRng, RngCore}; +use necsim_core::cogs::{Backup, MathsCore, PrimeableRng, RngCore}; use serde::{Deserialize, Serialize}; @@ -23,6 +23,13 @@ pub struct WyHash { marker: PhantomData, } +#[contract_trait] +impl Backup for WyHash { + unsafe fn backup_unchecked(&self) -> Self { + self.clone() + } +} + impl RngCore for WyHash { type Seed = [u8; 8];