Struct Set

Source
pub struct Set<'a, S: Debug, D: DieOnce<S> + 'a> {
    pub name: &'a str,
    pub elem_die: D,
    /* private fields */
}
Expand description

A mathematical set that can be used to randomly choose Vars.

The elements of the set are represented by the generator. The set contains all elements that the generator could possibly generate.

Fields§

§name: &'a str

The name of the set.

§elem_die: D

A generator for the elements of the set.

Implementations§

Source§

impl<'a, S: Debug, D: DieOnce<S> + 'a> Set<'a, S, D>

Source

pub fn new(name: &'a str, elem_die: D) -> Self

Source

pub fn var_once(self, name: &'a str) -> impl DieOnce<Vars<'a, S, 1>>

Returns a generator that chooses a single variable from the set.

Source§

impl<'a, S: Debug, D: Die<S> + 'a> Set<'a, S, D>

Source

pub fn as_ref<'b: 'a>(&'b self) -> Set<'a, S, &'b D>

Returns a Set with the same name and a reference to the original generator.

Source

pub fn vars<const N: usize>( self, names: [&'a str; N], ) -> impl Die<Vars<'a, S, N>>

Returns a generator that chooses N variables from the set.

Auto Trait Implementations§

§

impl<'a, S, D> Freeze for Set<'a, S, D>
where D: Freeze,

§

impl<'a, S, D> RefUnwindSafe for Set<'a, S, D>

§

impl<'a, S, D> Send for Set<'a, S, D>
where D: Send, S: Send,

§

impl<'a, S, D> Sync for Set<'a, S, D>
where D: Sync, S: Sync,

§

impl<'a, S, D> Unpin for Set<'a, S, D>
where D: Unpin, S: Unpin,

§

impl<'a, S, D> UnwindSafe for Set<'a, S, D>
where D: UnwindSafe, S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.