pub enum Statement {
InputDecl(InputDecl),
Binding(Binding),
ModuleDef(ModuleDef),
ExternPort(ExternPort),
Cursor(CursorDecl),
Pragma {
name: String,
span: Span,
},
For(ForStmt),
Tile(TileDef),
}Expand description
A top-level statement.
Variants§
InputDecl(InputDecl)
input name[: type] — declares one per-cycle kernel input slot.
The name becomes both an input slot (settable via set_input)
and a passthrough output (readable via get_constant/pull).
Surface forms (parser desugars the tuple into N InputDecls,
mirroring the module-signature param-list shape from
a host-provided cycle module):
input cycle: u64
input (cycle: u64, q: f64)Binding(Binding)
A name-to-expression binding. The modifier on the binding determines its lifecycle:
- no modifier — per-cycle: re-evaluated every cycle.
const— effectively-const for the scope’s lifetime: materialized at the earliest opportunity (compile-time fold if the RHS is fold-eligible, otherwise scope-init pull after materialize-wiring has populated extern slots). Authors don’t need to know which path the runtime takes — the contract is “fixed once, then immutable.”shared— cell-backed, mutable across kernel instances in the same lineage. Seecrates/polydat/docs/design/scope_model.md§6 “Shared mutable bindings”.volatile— re-evaluated on every pull and never constant-folded. The program’s canonical hash (scope_model.md§8) covers the binding’s expression and itsvolatileflag, never a value it produced.
Surface forms:
x := mul(cycle, 2) // per-cycle
const pi := 3.14 // const, folds at compile
const ann_opts := str_concat(...) // const, materializes at scope-init
shared budget := 100 // shared cell
(a, b) := split_pair(...) // tuple destructuringModuleDef(ModuleDef)
name(param: type, ...) -> (output: type, ...) := { body }
ExternPort(ExternPort)
extern name: type = default
Cursor(CursorDecl)
cursor name = Cursor() or cursor name = constructor_expr
Pragma
pragma <name> — a directive opting the scope it is written
in, and every scope nested in it, into a compile-time check
(polydat_grammar.md §14).
First-class grammar, distinct from line
comments. Recognised pragmas trigger
CompileEvent::PragmaAcknowledged; unknown names trigger
CompileEvent::UnknownPragma and are otherwise ignored
(forward-compatible).
Fields
For(ForStmt)
for <source> { body } — a traversal scope (for_traversal.md §3.2).
One child scope activates per tuple of the source; the
comprehension’s element names are wires inside the body.
Tile(TileDef)
tile name : encoding (options) := body — a compiled variate
template (polytile.md §2).
Trait Implementations§
Auto Trait Implementations§
impl Forget for Statement
impl Freeze for Statementwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<String>: Freeze,
PhantomData<Expr>: Freeze,
PhantomData<Arg>: Freeze,
*const Expr is !null: Freeze,
*const ForSource is !null: Freeze,
PhantomData<ForSource>: Freeze,
PhantomData<TypedParam>: Freeze,
PhantomData<Statement>: Freeze,
PhantomData<LiteralValue>: Freeze,
PhantomData<ProductMeasure>: Freeze,
PhantomData<f64>: Freeze,
PhantomData<Comprehension>: Freeze,
*const Comprehension is !null: Freeze,
PhantomData<TilePiece>: Freeze,
impl Move for Statement
impl RefUnwindSafe for Statement
impl Send for Statement
impl Sync for Statement
impl Unpin for Statement
impl UnsafeUnpin for Statementwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
PhantomData<Expr>: UnsafeUnpin,
PhantomData<Arg>: UnsafeUnpin,
*const Expr is !null: UnsafeUnpin,
*const ForSource is !null: UnsafeUnpin,
PhantomData<ForSource>: UnsafeUnpin,
PhantomData<TypedParam>: UnsafeUnpin,
PhantomData<Statement>: UnsafeUnpin,
PhantomData<LiteralValue>: UnsafeUnpin,
PhantomData<ProductMeasure>: UnsafeUnpin,
PhantomData<f64>: UnsafeUnpin,
PhantomData<Comprehension>: UnsafeUnpin,
*const Comprehension is !null: UnsafeUnpin,
PhantomData<TilePiece>: UnsafeUnpin,
impl UnwindSafe for Statementwhere
RawVecInner: UnwindSafe,
BoxRaw<Expr>: UnwindSafe,
BoxRaw<ForSource>: UnwindSafe,
NonNull<u8>: UnwindSafe,
BoxRaw<Comprehension>: UnwindSafe,
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,
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