Struct netstack3_core::testutil::FakeCryptoRng
source · pub struct FakeCryptoRng<R>(/* private fields */);
Expand description
A wrapper which implements RngCore
and CryptoRng
for any RngCore
.
This is used to satisfy [EventDispatcher
]’s requirement that the
associated Rng
type implements CryptoRng
.
§Security
This is obviously insecure. Don’t use it except in testing!
Trait Implementations§
source§impl<R: Clone> Clone for FakeCryptoRng<R>
impl<R: Clone> Clone for FakeCryptoRng<R>
source§fn clone(&self) -> FakeCryptoRng<R>
fn clone(&self) -> FakeCryptoRng<R>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<R: Debug> Debug for FakeCryptoRng<R>
impl<R: Debug> Debug for FakeCryptoRng<R>
source§impl Default for FakeCryptoRng<XorShiftRng>
impl Default for FakeCryptoRng<XorShiftRng>
source§fn default() -> FakeCryptoRng<XorShiftRng>
fn default() -> FakeCryptoRng<XorShiftRng>
Returns the “default value” for a type. Read more
source§impl<R: RngCore> RngContext for FakeCryptoRng<R>
impl<R: RngCore> RngContext for FakeCryptoRng<R>
source§impl<R: RngCore> RngCore for FakeCryptoRng<R>
impl<R: RngCore> RngCore for FakeCryptoRng<R>
source§fn fill_bytes(&mut self, dest: &mut [u8])
fn fill_bytes(&mut self, dest: &mut [u8])
Fill
dest
with random data. Read moresource§impl<R: SeedableRng> SeedableRng for FakeCryptoRng<R>
impl<R: SeedableRng> SeedableRng for FakeCryptoRng<R>
§type Seed = <R as SeedableRng>::Seed
type Seed = <R as SeedableRng>::Seed
Seed type, which is restricted to types mutably-dereferencable as
u8
arrays (we recommend [u8; N]
for some N
). Read moresource§fn seed_from_u64(state: u64) -> Self
fn seed_from_u64(state: u64) -> Self
Create a new PRNG using a
u64
seed. Read moresource§fn from_rng<R>(rng: R) -> Result<Self, Error>where
R: RngCore,
fn from_rng<R>(rng: R) -> Result<Self, Error>where
R: RngCore,
Create a new PRNG seeded from another
Rng
. Read moresource§fn from_entropy() -> Self
fn from_entropy() -> Self
impl<R: RngCore> CryptoRng for FakeCryptoRng<R>
Auto Trait Implementations§
impl<R> Freeze for FakeCryptoRng<R>
impl<R> RefUnwindSafe for FakeCryptoRng<R>
impl<R> Send for FakeCryptoRng<R>where
R: Send,
impl<R> Sync for FakeCryptoRng<R>where
R: Send,
impl<R> Unpin for FakeCryptoRng<R>
impl<R> UnwindSafe for FakeCryptoRng<R>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<R> Rng for R
impl<R> Rng for R
source§fn gen<T>(&mut self) -> Twhere
Standard: Distribution<T>,
fn gen<T>(&mut self) -> Twhere
Standard: Distribution<T>,
source§fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
Generate a random value in the given range. Read more
source§fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
Sample a new value, using the given distribution. Read more
source§fn sample_iter<T, D>(self, distr: D) -> DistIter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
fn sample_iter<T, D>(self, distr: D) -> DistIter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
Create an iterator that generates values using the given distribution. Read more
source§fn gen_bool(&mut self, p: f64) -> bool
fn gen_bool(&mut self, p: f64) -> bool
Return a bool with a probability
p
of being true. Read moresource§fn gen_ratio(&mut self, numerator: u32, denominator: u32) -> bool
fn gen_ratio(&mut self, numerator: u32, denominator: u32) -> bool
Return a bool with a probability of
numerator/denominator
of being
true. I.e. gen_ratio(2, 3)
has chance of 2 in 3, or about 67%, of
returning true. If numerator == denominator
, then the returned value
is guaranteed to be true
. If numerator == 0
, then the returned
value is guaranteed to be false
. Read moresource§impl<Id, CC, BC> TimerHandler<BC, Id> for CCwhere
Id: HandleableTimer<CC, BC>,
impl<Id, CC, BC> TimerHandler<BC, Id> for CCwhere
Id: HandleableTimer<CC, BC>,
source§fn handle_timer(&mut self, bindings_ctx: &mut BC, id: Id)
fn handle_timer(&mut self, bindings_ctx: &mut BC, id: Id)
Handle a timer firing.