Struct UniformArrayStrategy

struct UniformArrayStrategy<S, T> { ... }

A Strategy which generates fixed-size arrays containing values drawn from an inner strategy.

T must be an array type of length 1 to 32 whose values are produced by strategy S. Instances of this type are normally created by the various uniformXX functions in this module.

This is mainly useful when the inner strategy is not Copy, precluding expressing the strategy as [myStrategy; 32], for example.

Example

use proptest::prelude::*;

proptest! {
  #[test]
  fn test_something(a in prop::array::uniform32(1u32..)) {
    let unexpected = [0u32;32];
    // `a` is also a [u32;32], so we can compare them directly
    assert_ne!(unexpected, a);
  }
}
# fn main() { }

Implementations

impl<S, T> UniformArrayStrategy<S, T>

fn new(strategy: S) -> Self

Directly create a UniformArrayStrategy.

This is only intended for advanced use, since the only way to specify the array size is with the turbofish operator and explicitly naming the type of the values in the array and the strategy itself.

Prefer the uniformXX functions at module-level unless something precludes their use.

impl<S, T> Freeze for UniformArrayStrategy<S, T>

impl<S, T> RefUnwindSafe for UniformArrayStrategy<S, T>

impl<S, T> Send for UniformArrayStrategy<S, T>

impl<S, T> Sync for UniformArrayStrategy<S, T>

impl<S, T> Unpin for UniformArrayStrategy<S, T>

impl<S, T> UnwindSafe for UniformArrayStrategy<S, T>

impl<S: $crate::clone::Clone, T: $crate::clone::Clone> Clone for UniformArrayStrategy<S, T>

fn clone(self: &Self) -> UniformArrayStrategy<S, T>

impl<S: $crate::fmt::Debug, T: $crate::fmt::Debug> Debug for UniformArrayStrategy<S, T>

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

impl<S: $crate::marker::Copy, T: $crate::marker::Copy> Copy for UniformArrayStrategy<S, T>

impl<S: Strategy, N: usize> Strategy for UniformArrayStrategy<S, [<S as >::Value; N]>

fn new_tree(self: &Self, runner: &mut TestRunner) -> NewTree<Self>

impl<T> Any for UniformArrayStrategy<S, T>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for UniformArrayStrategy<S, T>

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

impl<T> BorrowMut for UniformArrayStrategy<S, T>

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

impl<T> CloneToUninit for UniformArrayStrategy<S, T>

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

impl<T> From for UniformArrayStrategy<S, T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for UniformArrayStrategy<S, T>

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

impl<T, U> Into for UniformArrayStrategy<S, T>

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 UniformArrayStrategy<S, T>

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

impl<T, U> TryInto for UniformArrayStrategy<S, T>

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

impl<V, T> VZip for UniformArrayStrategy<S, T>

fn vzip(self: Self) -> V