Skip to main content

Parameter

Enum Parameter 

Source
pub enum Parameter {
    Integer(IntegerParameter),
    Double(DoubleParameter),
    Boolean(BooleanParameter),
    String(StringParameter),
    Selection(SelectionParameter),
    Derived(DerivedParameter),
}
Expand description

Kind-tagged parameter.

See per-variant structs for constructors and builder-style setters. Dispatch methods (name, kind, default, generate, …) forward to the inner variant.

Variants§

§

Integer(IntegerParameter)

Integer parameter.

§

Double(DoubleParameter)

Double parameter.

§

Boolean(BooleanParameter)

Boolean parameter.

§

String(StringParameter)

String parameter.

§

Selection(SelectionParameter)

Selection parameter.

§

Derived(DerivedParameter)

Derived parameter.

Implementations§

Source§

impl Parameter

Source

pub const fn name(&self) -> &ParameterName

Parameter name.

Source

pub const fn kind(&self) -> ValueKind

Parameter kind.

Source

pub const fn domain(&self) -> Option<Domain<'_>>

Borrowed domain view. Returns None for Self::Derived (derived parameters don’t own a domain in this SRD tier).

Source

pub fn default(&self) -> Option<Value>

The default value, wrapped in Value with Default provenance, if one is set.

Source

pub fn generate<R: Rng + ?Sized>(&self, rng: &mut R) -> Value

Pick a value. Uses the registered default if present, else samples uniformly from the domain.

§Panics

Panics when called on Self::Derived (derived parameters are computed from bindings, not sampled) or on domains whose sampling is not implemented (regex, external selection).

Source

pub fn generate_random<R: Rng + ?Sized>(&self, rng: &mut R) -> Value

Always draws from the domain, ignoring any default.

§Panics

Panics on Self::Derived and on domains whose sampling is unimplemented.

Source

pub fn generate_boundary<R: Rng + ?Sized>(&self, rng: &mut R) -> Value

Pick a boundary value from the domain.

§Panics

Panics on Self::Derived (no domain).

Source

pub fn validate(&self, value: &Value) -> ValidationResult

Validate a candidate Value against this parameter’s kind, domain, and registered constraints.

Source

pub fn satisfies(&self, c: &Constraint) -> bool

Best-effort “is any value in the domain satisfied by this constraint?” check. Tests the domain’s boundary values plus up to eight deterministic random samples (seeded for reproducibility). False negatives possible; false positives are not.

Returns false for derived parameters (no domain to probe), for kind mismatches, and for domains that panic on sampling (regex, external selection) — those would need a richer check.

Trait Implementations§

Source§

impl Attributed for Parameter

Source§

fn labels(&self) -> &Labels

Intrinsic facts.
Source§

fn tags(&self) -> &Tags

Extrinsic organisation.
Source§

impl Clone for Parameter

Source§

fn clone(&self) -> Parameter

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Parameter

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Parameter

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Parameter

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Parameter

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Parameter

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,