[package]
name = "embassy-supervisor-macros"
# Versioned independently of `embassy-supervisor`, which pins this crate by EXACT
# version (`=x.y.z`): the generated code references doc(hidden) supervisor internals,
# so only the tested pair is guaranteed compatible. Bump only when the macro changes;
# the supervisor updates its pin to match.
version = "0.4.1"
edition.workspace = true
authors.workspace = true
license.workspace = true
repository.workspace = true
rust-version.workspace = true
readme = "README.md"
documentation = "https://docs.rs/embassy-supervisor-macros"
description = "Proc-macro for embassy-supervisor: declares a task graph and computes its topological order at compile time."
keywords = ["embassy", "async", "embedded", "supervisor", "no-std"]
categories = ["embedded", "asynchronous", "no-std"]

[lib]
proc-macro = true

[package.metadata.docs.rs]
all-features = true

[features]
# Read at expansion time via `cfg!(feature = "pool")` to decide whether the
# generated `GRAPH` carries a `pools` field + the pool statics. The parent
# `embassy-supervisor` crate forwards its own `pool` feature here (see its
# Cargo.toml), so this tracks the supervisor's pool feature — the macro emits
# pools iff the supervisor was built with pools.
pool = []
# Forwarded from the supervisor's `local-resources` feature: permits the `local`
# resource kind, whose slot type carries an `unsafe impl Sync` EMITTED INTO THE
# CONSUMER'S CRATE (this is why it is opt-in and off by default). Without it, a
# `local` marker is a span-attached compile error naming the feature.
local-resources = []
# Forwarded from the supervisor's `trace` feature: the generated spawn glue captures
# each SpawnToken's task id into the node (`set_task_id`) before spawning it.
trace = []
# Forwarded from the supervisor's `metadata-names` feature: the generated spawn glue
# stamps the node name into the task's Metadata (`stamp_name`). Read at expansion
# time by `spawn_stmts`; independent of `trace`, so a graph built with names but not
# `trace` emits the name-only spawn path (no `adopt`, no id capture).
metadata-names = []
# Forwarded from `trace-names`: the full trace layer with node names = trace + the
# name stamp. Kept as an alias for back-compat; effective behavior unchanged.
trace-names = ["trace", "metadata-names"]
# Forwarded from the supervisor's `trace-hooks`: emit the seven `no_mangle`
# `_embassy_trace_*` hook definitions at the graph declaration site (the supervisor
# crate itself is `forbid(unsafe_code)` and cannot define them).
trace-hooks = ["trace"]

[dependencies]
syn = { version = "2.0.118", features = ["full"] }
quote = "1"
proc-macro2 = "1"

# `trybuild` UI tests: compile-fail cases lock the macro's error contracts (cycle,
# unknown dep, etc.); compile-pass cases exercise the codegen end-to-end. The graph
# the macro generates references `embassy-supervisor` + `embassy-executor`, and
# linking a pass binary needs a critical-section impl + an embassy-time driver (same
# shims the supervisor's own host tests use). All dev-only — proc-macro crates build
# for the host, and dev-deps never reach a consumer, so this is host/test-only.
# (embassy-supervisor depends back on this crate; a dev-dependency cycle is allowed.)
[dev-dependencies]
trybuild = "1"
embassy-supervisor = { path = "../supervisor" }
# `platform-std` + `executor-thread` give embassy-executor a host Pender/executor so a
# compile-pass case that uses real `#[embassy_executor::task]`s can link on the host.
embassy-executor = { version = "0.10", features = ["platform-std", "executor-thread"] }
critical-section = { version = "1", features = ["std"] }
embassy-time = { version = "0.5", features = ["mock-driver"] }
