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 (comprehension_forms.md §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 (comprehension_forms.md §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 names_read(&self) -> BTreeSet<String>
pub fn names_read(&self) -> BTreeSet<String>
The names evaluating this source reads from the prior axes and
the scope it is evaluated in (comprehension_forms.md §5 V3,
§10.9.1). This differs from Self::referenced_names in two
forms. A composed name ({k_{k}_limits}) reads its leaves
(k) here; the name they compose to is known only once the
leaves are bound, and is read when the source is evaluated. The
cursor form all(<cursor>) reads the cursor’s extent outputs
(cursor_extent_names), not a value named after the cursor.
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).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Source
impl<'de> Deserialize<'de> for Source
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Source, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Source, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for Source
impl Serialize for Source
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl SourceEval for Source
impl SourceEval for Source
Source§fn eval_class(&self) -> EvalClass
fn eval_class(&self) -> EvalClass
EvalClass.Source§fn evaluate(
&self,
ctx: Option<&EvalContext<'_>>,
) -> Result<EvaluatedSource, EvalError>
fn evaluate( &self, ctx: Option<&EvalContext<'_>>, ) -> Result<EvaluatedSource, EvalError>
impl StructuralPartialEq for Source
Auto Trait Implementations§
impl Forget for Source
impl Freeze for Sourcewhere
*const u8 is !null: Freeze,
PhantomData<LiteralValue>: Freeze,
PhantomData<u8>: Freeze,
PhantomData<ProductMeasure>: Freeze,
PhantomData<f64>: Freeze,
impl Move for Source
impl RefUnwindSafe for Source
impl Send for Source
impl Sync for Source
impl Unpin for Source
impl UnsafeUnpin for Sourcewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<LiteralValue>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<ProductMeasure>: UnsafeUnpin,
PhantomData<f64>: UnsafeUnpin,
impl UnwindSafe for Source
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more