pub struct EmitProjectCtx {Show 36 fields
pub source_path: PathBuf,
pub identity_path: String,
pub commons_name: String,
pub file_decl_index: FileDeclIndex,
pub imported_from: HashMap<String, String>,
pub imported_from_kind: HashMap<String, UnitKind>,
pub imported_decl_paths: HashMap<String, HashMap<String, PathBuf>>,
pub consumed_type_aliases: HashMap<String, String>,
pub unit_kind: UnitKind,
pub owning_context: Option<String>,
pub exports_for_consumed: HashMap<String, HashMap<String, Visibility>>,
pub cross_context: CrossContextInfo,
pub target: BuildTarget,
pub local_agents: HashSet<String>,
pub agent_given_deps: HashMap<String, String>,
pub agent_given_deps_names: HashMap<String, Vec<String>>,
pub extra_imports: Vec<ExtraImport>,
pub agent_method_givens: HashMap<String, HashMap<String, Vec<CapRefIr>>>,
pub agent_called_contexts: Vec<String>,
pub actors: HashMap<String, ActorDecl>,
pub event_schema_versions: HashMap<String, i64>,
pub agent_schema_versions: HashMap<String, AgentVersions>,
pub consumed_adapters: HashSet<String>,
pub consumed_types_with_methods: HashSet<String>,
pub import_ext: ImportExt,
pub contracts: bool,
pub trace: Option<TraceLoc>,
pub inspect_agents: bool,
pub history_target_agents: HashSet<String>,
pub asset_served: BTreeMap<String, String>,
pub embed_text: BTreeMap<String, String>,
pub imported_methods: HashMap<String, Vec<FnSig>>,
pub runtime_use: RuntimeUse,
pub worker_layout: WorkerLayout,
pub unit_source: Option<UnitSource>,
pub type_spellings: HashMap<String, String>,
}Fields§
§source_path: PathBufSource path of the file being emitted (relative to project root).
identity_path: StringThe file’s project-relative identity path, as the test runner reports it in
an expect’s location. A violated declaration’s location is built from it (#2272).
commons_name: StringJoined name of the commons or context this file belongs to.
file_decl_index: FileDeclIndexWhich file declares each name in the local unit.
imported_from: HashMap<String, String>For each imported name, the joined name of the unit it came from.
imported_from_kind: HashMap<String, UnitKind>For each imported name, the kind (commons vs context) of the source unit.
imported_decl_paths: HashMap<String, HashMap<String, PathBuf>>For each imported unit, the file path that declares each name.
consumed_type_aliases: HashMap<String, String>#2887: the types this unit renames with consumes U { T as Alias },
alias → the name the consumed module declares it under.
unit_kind: UnitKindWhat kind of unit this is.
owning_context: Option<String>For contexts: this context’s qualified name (used as the brand for rebranded mixed-in types and exported types).
exports_for_consumed: HashMap<String, HashMap<String, Visibility>>For contexts: exports of each consumed context (so the emitter knows which names to import and how).
cross_context: CrossContextInfoFor contexts: full cross-context information (consumed contexts, aliases, consumed services and types). Mirrors what the resolver and checker see (v0.6).
target: BuildTargetv0.8 build target. Workers mode reroutes cross-context calls through Service Bindings and adds per-Worker entry/composition artefacts.
local_agents: HashSet<String>Agent names declared in this unit. The body lowering uses this set
to recognise Agent(key) construction and agent_instance.method(...)
dispatch.
agent_given_deps: HashMap<String, String>#527: for each local agent with given capabilities, the TS
expression building those deps DO-side (workers contexts only; the DO
wire cannot carry providers). Consumed by emit_agent’s fetch branch.
agent_given_deps_names: HashMap<String, Vec<String>>1A.36b-2: for each agent in agent_given_deps, the namespaces its expression spells
(bynk__binding, handlers_shop_orders), declared with the text so the module’s imports
follow its tree.
extra_imports: Vec<ExtraImport>#527: extra imports handlers.ts needs for the expressions above.
agent_method_givens: HashMap<String, HashMap<String, Vec<CapRefIr>>>#527: for each local agent, each on call method’s given capability
list. The lowering records which agent methods a handler body calls so
the handler’s emitted deps type carries the callee’s capabilities —
the runtime deps value (built by compose) always did.
agent_called_contexts: Vec<String>#1961: the consumed contexts the context’s agents call
(emitter::agent_cross_context_targets), unit-wide. A handler that
constructs an agent names them in its deps.env type.
actors: HashMap<String, ActorDecl>v0.47: the context’s actor declarations (merged across files), keyed by
name. Used to resolve a handler’s Bearer verification seam in emit.rs
regardless of which file declares the actor.
event_schema_versions: HashMap<String, i64>Events slice 3b (#978): each locally-declared event’s resolved
@schema(N) version (or 1 if absent), merged across files the same
way actors is above — Events.emit[E]’s lowering site only has
E’s bare name (the turbofish type argument), never its declaration,
so this is threaded down to ModuleCtx/LowerCtx rather than
re-derived from the per-file synthetic Commons lower.rs otherwise
sees (which would silently miss an event declared in a sibling file).
agent_schema_versions: HashMap<String, AgentVersions>State-migrations S1 (#2211): each locally-declared agent’s lock
version and oldest readable stored version, keyed by agent name.
Empty when the build has no lock (SchemaLock::Off), in which case the
agent emits no version logic at all (Decision A).
consumed_adapters: HashSet<String>v0.17: consumed unit names that are adapters. An adapter is not a Worker,
so in workers mode its capability types are imported from its root module
(<adapter>.ts), not from a per-Worker handlers.ts.
consumed_types_with_methods: HashSet<String>#2045: the types of consumed contexts (adapters aside) that carry
attached methods. A call to one (b.big() lowers to Batch.big(b)) runs
the callee’s own code from its companion object, so that name is a real
value import; every other consumed context type imports type-only.
import_ext: ImportExtSlice 2: the extension emitted import specifiers use (.js default; .ts
for the bynk test --inspect debug build). Consulted by runtime_import_for
and the sibling/cross-commons specifier helpers.
contracts: boolv0.115 (testing track slice 3): emit the function-contract call-site guard (dev/test profile). Stripped in the deploy build for zero runtime cost.
trace: Option<TraceLoc>#3580: Some emits the per-request trace recording (bynk dev --trace-events): the cross-context, agent and capability sites wrapped in
__traceStep, and the Worker’s fetch in __traceFetch. Never set by a
deploy build, whose output is byte-identical.
inspect_agents: bool#3581: emit the dev-only agent inspection (the instance recording in each
agent factory and the /_bynk/inspect branch of each agent). false for
every build but bynk dev, so a deploy build is byte-identical.
history_target_agents: HashSet<String>v0.119 (testing track slice 7, ADR 0155): agent names a for all run: History[Agent] property in this project drives. Only these agents gain the
exported __bynkDriveHistory_<Agent> test-support driver — every other
agent’s emission is byte-for-byte unchanged.
asset_served: BTreeMap<String, String>#1883, slice 1b: each declared asset’s served URL path, keyed by its
normalised source path (assets::declared_served_paths) — the value
of the asset’s .url.
embed_text: BTreeMap<String, String>#2387, slice 2: each declared embed’s text, keyed by its normalised
source path (embeds::read_declared_embeds) — the value of the
embed’s constant.
imported_methods: HashMap<String, Vec<FnSig>>v0.132.1 (#481): for a context, the user-defined attached methods of each
uses-imported refined/opaque type, keyed by the type’s name and sorted
by method name. The context’s own TypedCommons merges the imported
types but not their fn items, so emit_context_rebrands reads this to
forward Cents.fromInt(…) and friends onto the rebranded const. Empty
for commons units and for contexts with no such imports.
P6.18: each entry is a resolved FnSig (the declaring unit’s own
params/return_ty, already TyId-typed), not a raw FnDecl —
see build_emit_unit_ctx’s own doc comment for why.
runtime_use: RuntimeUseWhich conditional runtime.ts helpers this file’s emission referenced.
Unlike every field above, this is an output, not an input: emission
writes it (through &self, via interior mutability) and the header /
import post-pass reads it back. It rides on the context because the
producers — the Bytes kernel in lower, the boundary codecs in
serialisation, the ICU formatters in emit — already receive &ctx,
so no other signature has to change to carry the fact up.
One EmitProjectCtx is built per emitted file, immediately before its
emit_project call, so the flags cannot leak between files. Replaces a
substring scan of the generated text; see emitter::runtime_use.
worker_layout: WorkerLayout#3562: where each context’s generated files go on Workers.
unit_source: Option<UnitSource>#2620: the unit’s source and identity path; None for single-file emission.
type_spellings: HashMap<String, String>#1927: a uses-imported type this unit hides behind its own value (a
function, asset, service, agent or provider of the same name), type name
to the inline import type that names it, import("<module>").Name. Empty
for a unit that hides none.
Implementations§
Source§impl EmitProjectCtx
impl EmitProjectCtx
Sourcepub fn consumed_context_types(&self) -> HashSet<String>
pub fn consumed_context_types(&self) -> HashSet<String>
#2045: on workers, the types this unit imports from a consumed
context (not an adapter): each is another Worker’s, so this module
names it in type position only and builds its sum variants inline.
pub fn commons_path(name: &str) -> PathBuf
Auto Trait Implementations§
impl !Freeze for EmitProjectCtx
impl !RefUnwindSafe for EmitProjectCtx
impl Send for EmitProjectCtx
impl !Sync for EmitProjectCtx
impl Unpin for EmitProjectCtx
impl UnsafeUnpin for EmitProjectCtx
impl UnwindSafe for EmitProjectCtx
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<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);