pub enum Source {
Literal {
values: Vec<LiteralValue>,
},
IntRange {
lo: i64,
hi: i64,
step: i64,
},
Generator {
expr: String,
cardinality_hint: Option<u64>,
},
WorkloadParamList {
name: String,
len_hint: Option<u64>,
},
ContinuousInterval {
interval: Interval,
measure: ProductMeasure,
},
Distribution {
distribution: MeasureName,
support: Interval,
params: Vec<f64>,
},
}Expand description
A clause’s source of values.
Discrete variants produce a stream of Value via the
runtime evaluator; continuous variants describe a measure
that a downstream sampling strategy will draw from.
Variants§
Literal
Literal comma list (e.g., [1, 2, 4, 8]). Stream
producer over the list contents.
Fields
values: Vec<LiteralValue>The values, in order.
IntRange
Integer half-open range lo..hi with optional step.
Default step is 1.
Fields
Generator
Generator function call expressed as a Polydat source string. Its eval class follows its free names (spec §10.7.0): an expression that references no name is context-free and is evaluated at compile, so a clause over it becomes a literal of its values; one that references a name (an outer coordinate, a parameter, a wire) is evaluated at traversal.
Fields
WorkloadParamList
Reference to a workload-level parameter that resolves to a list of values. Cardinality is the parameter’s declared list length.
ContinuousInterval
Real interval (continuous source). Combined with a
measure to form a Continuous cardinality.
Integrability is checked at parse via V8.
Distribution
Named continuous distribution. The distribution carries
its own support; the support field records the
effective interval for V8’s check.
Fields
distribution: MeasureNameThe distribution.
params: Vec<f64>Its parameters, in the order of
MeasureName::parameter_names; empty for the standard
parameters (MeasureName::default_params).
Implementations§
Source§impl Source
impl Source
Sourcepub fn referenced_names(&self) -> BTreeSet<String>
pub fn referenced_names(&self) -> BTreeSet<String>
The names this source references (spec §10.7.0): a generator
expression’s parsed free identifiers (concat(foo)) and its
{name} interpolation placeholders, and a workload parameter
list’s own name. Literals, ranges, and intervals reference
nothing. A source with no references is context-free.
Sourcepub fn cardinality(&self) -> CardinalityClass
pub fn cardinality(&self) -> CardinalityClass
Declare this source’s cardinality class for use by
clause metadata propagation.
Sourcepub fn is_continuous(&self) -> bool
pub fn is_continuous(&self) -> bool
true if this source is continuous (Continuous /
Distribution variants). Used by V7 (zip must be all
discrete) and V9 (union must be all discrete) without
a full cardinality computation.
Sourcepub fn is_discrete(&self) -> bool
pub fn is_discrete(&self) -> bool
true if this source is discrete (every variant except
the continuous ones).