pub struct Probability(/* private fields */);
Expand description
A probability in the range [0.0, 1.0]
with a default of 0.5
.
Implementations§
Source§impl Probability
impl Probability
Sourcepub fn new(prob: f64) -> Probability
pub fn new(prob: f64) -> Probability
Sourcepub fn with<X>(self, and: X) -> (Probability, X)
pub fn with<X>(self, and: X) -> (Probability, X)
Merges self together with some other argument producing a product
type expected by some implementations of A: Arbitrary
in
A::Parameters
. This can be more ergonomic to work with and may
help type inference.
Sourcepub fn lift<X>(self) -> (Probability, X)where
X: Default,
pub fn lift<X>(self) -> (Probability, X)where
X: Default,
Merges self together with some other argument generated with a
default value producing a product type expected by some
implementations of A: Arbitrary
in A::Parameters
.
This can be more ergonomic to work with and may help type inference.
Trait Implementations§
Source§impl Arbitrary for Probability
impl Arbitrary for Probability
Source§type Parameters = ()
type Parameters = ()
The type of parameters that
arbitrary_with
accepts for configuration
of the generated Strategy
. Parameters must implement Default
.Source§type Strategy = MapInto<RangeInclusive<f64>, Probability>
type Strategy = MapInto<RangeInclusive<f64>, Probability>
The type of
Strategy
used to generate values of type Self
.Source§fn arbitrary_with(
_args: <Probability as Arbitrary>::Parameters,
) -> <Probability as Arbitrary>::Strategy
fn arbitrary_with( _args: <Probability as Arbitrary>::Parameters, ) -> <Probability as Arbitrary>::Strategy
Source§impl Clone for Probability
impl Clone for Probability
Source§fn clone(&self) -> Probability
fn clone(&self) -> Probability
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 Debug for Probability
impl Debug for Probability
Source§impl Default for Probability
impl Default for Probability
Source§fn default() -> Probability
fn default() -> Probability
The default probability is 0.5, or 50% chance.
Source§impl From<Probability> for f64
impl From<Probability> for f64
Source§fn from(p: Probability) -> f64
fn from(p: Probability) -> f64
Converts to this type from the input type.
Source§impl From<f64> for Probability
impl From<f64> for Probability
Source§impl PartialEq for Probability
impl PartialEq for Probability
impl Copy for Probability
impl StructuralPartialEq for Probability
Auto Trait Implementations§
impl Freeze for Probability
impl RefUnwindSafe for Probability
impl Send for Probability
impl Sync for Probability
impl Unpin for Probability
impl UnwindSafe for Probability
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more