Struct Probability

struct Probability(_)

A probability in the range [0.0, 1.0] with a default of 0.5.

Implementations

impl Probability

fn new(prob: f64) -> Self

Creates a Probability from a f64.

Panics

Panics if the probability is outside interval [0.0, 1.0].

fn with<X>(self: Self, and: X) -> (Self, 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.

fn lift<X: Default>(self: 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: Arbitrary in A::Parameters. This can be more ergonomic to work with and may help type inference.

impl Arbitrary for crate::option::Probability

fn arbitrary_with(_args: <Self as >::Parameters) -> <Self as >::Strategy

impl Clone for Probability

fn clone(self: &Self) -> Probability

impl Copy for Probability

impl Debug for Probability

fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result

impl Default for Probability

fn default() -> Self

The default probability is 0.5, or 50% chance.

impl Freeze for Probability

impl From for Probability

fn from(prob: f64) -> Self

Creates a Probability from a f64.

Panics

Panics if the probability is outside interval [0.0, 1.0].

impl PartialEq for Probability

fn eq(self: &Self, other: &Probability) -> bool

impl RefUnwindSafe for Probability

impl Send for Probability

impl StructuralPartialEq for Probability

impl Sync for Probability

impl Unpin for Probability

impl UnwindSafe for Probability

impl<T> Any for Probability

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Probability

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Probability

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for Probability

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for Probability

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for Probability

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for Probability

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Probability

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Probability

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>

impl<V, T> VZip for Probability

fn vzip(self: Self) -> V