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
impl Parameter
Sourcepub const fn name(&self) -> &ParameterName
pub const fn name(&self) -> &ParameterName
Parameter name.
Sourcepub const fn domain(&self) -> Option<Domain<'_>>
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).
Sourcepub fn default(&self) -> Option<Value>
pub fn default(&self) -> Option<Value>
The default value, wrapped in Value with Default provenance,
if one is set.
Sourcepub fn generate<R: Rng + ?Sized>(&self, rng: &mut R) -> Value
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).
Sourcepub fn generate_random<R: Rng + ?Sized>(&self, rng: &mut R) -> Value
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.
Sourcepub fn validate(&self, value: &Value) -> ValidationResult
pub fn validate(&self, value: &Value) -> ValidationResult
Validate a candidate Value against this parameter’s kind,
domain, and registered constraints.
Sourcepub fn satisfies(&self, c: &Constraint) -> bool
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.