pub enum Value {
Integer(IntegerValue),
Double(DoubleValue),
Boolean(BooleanValue),
String(StringValue),
Selection(SelectionValue),
}Expand description
An observed parameter value, tagged by kind.
Serialises with a kind discriminator so wire formats are
self-describing:
{ "kind": "integer", "value": 42, "provenance": { ... } }Variants§
Integer(IntegerValue)
An i64 observation.
Double(DoubleValue)
An f64 observation.
Boolean(BooleanValue)
A bool observation.
String(StringValue)
A String observation.
Selection(SelectionValue)
A multi-item selection.
Implementations§
Source§impl Value
impl Value
Sourcepub const fn provenance(&self) -> &Provenance
pub const fn provenance(&self) -> &Provenance
Shared provenance for this value.
Sourcepub const fn parameter(&self) -> &ParameterName
pub const fn parameter(&self) -> &ParameterName
Owning parameter.
Sourcepub const fn fingerprint(&self) -> &Fingerprint
pub const fn fingerprint(&self) -> &Fingerprint
Canonical fingerprint computed at construction.
Sourcepub const fn as_integer(&self) -> Option<i64>
pub const fn as_integer(&self) -> Option<i64>
Borrow the i64 payload, if this is an integer value.
Sourcepub const fn as_double(&self) -> Option<f64>
pub const fn as_double(&self) -> Option<f64>
Borrow the f64 payload, if this is a double value.
Sourcepub const fn as_boolean(&self) -> Option<bool>
pub const fn as_boolean(&self) -> Option<bool>
Borrow the bool payload, if this is a boolean value.
Sourcepub const fn as_selection(&self) -> Option<&IndexSet<SelectionItem>>
pub const fn as_selection(&self) -> Option<&IndexSet<SelectionItem>>
Borrow the selection payload, if this is a selection value.
Sourcepub fn integer(
name: ParameterName,
value: i64,
generator: Option<GeneratorInfo>,
) -> Self
pub fn integer( name: ParameterName, value: i64, generator: Option<GeneratorInfo>, ) -> Self
Convenience constructor for an integer value.
Sourcepub fn double(
name: ParameterName,
value: f64,
generator: Option<GeneratorInfo>,
) -> Self
pub fn double( name: ParameterName, value: f64, generator: Option<GeneratorInfo>, ) -> Self
Convenience constructor for a double value.
Sourcepub fn boolean(
name: ParameterName,
value: bool,
generator: Option<GeneratorInfo>,
) -> Self
pub fn boolean( name: ParameterName, value: bool, generator: Option<GeneratorInfo>, ) -> Self
Convenience constructor for a boolean value.
Sourcepub fn string(
name: ParameterName,
value: impl Into<String>,
generator: Option<GeneratorInfo>,
) -> Self
pub fn string( name: ParameterName, value: impl Into<String>, generator: Option<GeneratorInfo>, ) -> Self
Convenience constructor for a string value.
Sourcepub fn selection(
name: ParameterName,
items: IndexSet<SelectionItem>,
generator: Option<GeneratorInfo>,
) -> Self
pub fn selection( name: ParameterName, items: IndexSet<SelectionItem>, generator: Option<GeneratorInfo>, ) -> Self
Convenience constructor for a selection value.
Sourcepub fn verify_fingerprint(&self) -> bool
pub fn verify_fingerprint(&self) -> bool
Recompute the canonical fingerprint from the payload and compare with the stored provenance fingerprint.
Returns true when they match. Intended for tamper-detection
checkpoints; not run automatically during deserialisation.