[][src]Struct proptest::option::Probability

pub struct Probability(_);

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

Methods

impl Probability[src]

pub fn new(prob: f64) -> Self[src]

Creates a Probability from a f64.

Panics

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

pub fn with<X>(self, and: X) -> (Self, X)[src]

Merges self together with some other argument producing a product type expected by some impelementations of A: Arbitrary in A::Parameters. This can be more ergonomic to work with and may help type inference.

pub fn lift<X: Default>(self) -> (Self, X)[src]

Merges self together with some other argument generated with a default value producing a product type expected by some impelementations of A: Arbitrary in A::Parameters. This can be more ergonomic to work with and may help type inference.

Trait Implementations

impl Arbitrary for Probability[src]

type Parameters = ()

The type of parameters that [arbitrary_with] accepts for configuration of the generated [Strategy]. Parameters must implement [Default]. Read more

type Strategy = MapInto<RangeInclusive<f64>, Self>

The type of [Strategy] used to generate values of type Self. Read more

fn arbitrary() -> Self::Strategy[src]

Generates a [Strategy] for producing arbitrary values of type the implementing type (Self). Read more

impl Clone for Probability[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Probability[src]

impl PartialEq<Probability> for Probability[src]

impl From<f64> for Probability[src]

fn from(prob: f64) -> Self[src]

Creates a Probability from a f64.

Panics

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

impl From<Probability> for f64[src]

impl Copy for Probability[src]

impl Default for Probability[src]

fn default() -> Self[src]

The default probability is 0.5, or 50% chance.

Auto Trait Implementations

impl Send for Probability

impl Sync for Probability

Blanket Implementations

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T