Skip to main content

Crate embassy_supervisor_syntax

Crate embassy_supervisor_syntax 

Source
Expand description

Parser and AST for the embassy-supervisor task-graph DSL.

This crate exists because a proc-macro crate type cannot export anything other than macros, so the grammar shared between embassy-supervisor-macros and tooling lives here instead. The AST is an internal contract: it is not a stable API and changes whenever the graph syntax does.

The parser checks grammatical shape (empty clauses, repeated paths, numeric ranges, and so on). Semantic checks such as duplicate names, missing fragments, or feature-gated constructs are left to callers.

Modules§

kw
Custom keywords used by the supervisor graph DSL.

Structs§

Access
One dataflow access discovered by scanning a #[dataflow] fn body.
AdoptedFn
A function adopted via a dataflow: [ ... ] clause.
CommonClauses
Clauses shared between node and pool declarations.
Dep
A single entry in a deps: [ ... ] list.
ExecutorItem
A parsed executor NAME; declaration.
Gated
A clause value together with the #[cfg(...)] attributes gating it.
GraphSpec
The parsed contents of a supervisor_graph! or supervisor_fragment! body.
NodeItem
A parsed node NAME = Mode, ...; declaration.
PoolItem
A parsed pool NAME = [Mode, ...], ...; declaration.
ProvideDecl
A single provides: entry: a resource-slot name, optionally #[cfg]-gated.
ResourceDecl
A single entry in a resources: [ ... ] list.
SignalDecl
A single entry in a reads: or writes: signal list.
VerbCall
A single dataflow verb call discovered in a #[dataflow] fn body.
VerbTable
Registry of read/write verbs used when scanning a #[dataflow] fn.

Enums§

Item
A top-level item inside a graph declaration.
ResourceKind
How a resources: entry hands its value to the task, as one value the consumers branch on instead of probing the marker fields.
StateInit
How a node’s state: initial value is specified.
TaskSource
How a node or pool member obtains its task future.

Constants§

BUILTIN_READS
Built-in read verb names recognised by the dataflow scanner.
BUILTIN_WRITES
Built-in write verb names recognised by the dataflow scanner.

Functions§

apply_default_executor
Apply the graph’s default executor to nodes and pools that do not write their own executor: clause. Only items whose task source is a task: fn or a spawn: path/partial call are eligible; parked nodes and verbatim spawn: closures keep the supervisor’s executor.
cfg_text
The #[cfg] attributes’ token text, normalized for predicate comparison.
check_signal_list
Check that a reads: or writes: list is non-empty and has no duplicates.
dataflow_attr
Unwrap a #[dataflow] attribute, including any #[cfg_attr(...)] wrapper.
is_dataflow_attr
Return true if attr is a #[dataflow] attribute, written directly or wrapped in #[cfg_attr(.., dataflow)]. See dataflow_attr.
item_executor
Return the executor: an item routes through, if it names one.
item_ident_cfg
Return the identifying name and #[cfg] attributes of an item, if it has one.
item_resources
Return the resource declarations for an item, if any.
item_signal_entries
Iterate over every signal entry declared by an item.
name_string
Convert an identifier to a lower-case, hyphenated string.
node_param
Find the name of the function argument whose type contains TaskNode.
normalize_fragment_crate
Rewrite bare crate paths in a fragment body into $crate.
parse_dep_list
Parse a bracketed dependency list of the form [A, B ready, C ready bound].
parse_mode_list
Parse a bracketed list of pool member mode identifiers.
parse_node
Parse a node NAME = Mode, ...; declaration after the leading node keyword.
parse_pool
Parse a pool NAME = [Mode, ...], ...; declaration after the leading pool keyword.
parse_resource_list
Parse a bracketed resource list such as [SLOT: Type local shared].
parse_signal_list
Parse a bracketed signal list such as [S, T observed, U beat].
path_to_string
Render a syn::Path as its ::-separated string form.
peek_kind_marker
Look ahead for a resource kind marker (local, consume, shared, divisible, or serialized).
rewrite_verb_calls
Walk a #[dataflow] fn body and rewrite recognised verb calls.
scan_dataflow
Scan Rust source for #[dataflow] functions and append their accesses to out.
substitute_dollar_crate
Replace every $crate occurrence in stream with replacement.
task_source
Resolve the optional spawn: / task: clauses into a TaskSource.
verb_table_of
Build a VerbTable from a #[dataflow(...)] attribute.