Struct Probability
pub struct Probability(/* private field */);
A probability in the range [0.0, 1.0] with a default of 0.5.
Implementations
impl Probability
fn new(prob: f64) -> SelfCreates a
Probabilityfrom af64.Panics
Panics if the probability is outside interval
[0.0, 1.0].fn with<X>(self, and: X) -> (Self, X)Merges self together with some other argument producing a product type expected by some implementations of
A: ArbitraryinA::Parameters. This can be more ergonomic to work with and may help type inference.fn lift<X: Default>(self) -> (Self, X)Merges self together with some other argument generated with a default value producing a product type expected by some implementations of
A: ArbitraryinA::Parameters. This can be more ergonomic to work with and may help type inference.
Trait Implementations
impl Arbitrary for Probability
type Parameters = ();type Strategy = MapInto<RangeInclusive<f64>, Probability>;fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy
impl Clone for Probability
fn clone(&self) -> Probability
impl Copy for Probability
impl Debug for Probability
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for Probability
fn default() -> SelfThe default probability is 0.5, or 50% chance.
impl From<f64> for Probability
fn from(prob: f64) -> SelfCreates a
Probabilityfrom af64.Panics
Panics if the probability is outside interval
[0.0, 1.0].
impl PartialEq for Probability
fn eq(&self, other: &Probability) -> bool
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 UnsafeUnpin for Probability
impl UnwindSafe for Probability
Blanket Implementations
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for Probability
where
ST: ?Sized,
DT: ?Sized,
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for Probability
where
ST: ?Sized,
DT: ?Sized,
impl<T> Any for Probability
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Probability
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Probability
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Probability
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Probability
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Read<Exclusive, BecauseExclusive> for Probability
where
T: ?Sized,
impl<T> ToOwned for Probability
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for Probability
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Probability
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Probability
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
impl<V, T> VZip<V> for Probability
where
V: MultiLane<T>,
fn vzip(self) -> V