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

pub struct Probability(_);

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

Implementations

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 implementations 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 implementations 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

impl Clone for Probability[src]

impl Copy for Probability[src]

impl Debug for Probability[src]

impl Default for Probability[src]

fn default() -> Self[src]

The default probability is 0.5, or 50% chance.

impl From<Probability> for f64[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 PartialEq<Probability> for Probability[src]

impl StructuralPartialEq for Probability[src]

Auto Trait Implementations

impl RefUnwindSafe for Probability[src]

impl Send for Probability[src]

impl Sync for Probability[src]

impl Unpin for Probability[src]

impl UnwindSafe for Probability[src]

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,