pub struct Ctx<'a> {Show 22 fields
pub input: &'a ResolvedCommons,
pub expr_types: &'a mut HashMap<Span, Ty>,
pub errors: &'a mut Vec<CompileError>,
pub refs: &'a mut RefSink,
pub hints: &'a mut HintSink,
pub locals: &'a mut LocalsSink,
pub requirements: &'a mut RequirementSink,
pub scopes: Vec<HashMap<String, Ty>>,
pub return_ty: Ty,
pub return_ty_span: Span,
pub effectful: bool,
pub agent_state_ty: Option<Ty>,
pub commit_seen: bool,
pub caps: CapabilityCtx,
pub in_test_body: bool,
pub test_services: HashSet<String>,
pub type_vars: HashSet<String>,
pub store_cells: HashMap<String, Ty>,
pub store_maps: HashMap<String, (Ty, Ty)>,
pub store_sets: HashMap<String, Ty>,
pub store_caches: HashMap<String, (Ty, Ty, i64)>,
pub store_logs: HashMap<String, Ty>,
}Fields§
§input: &'a ResolvedCommons§expr_types: &'a mut HashMap<Span, Ty>§errors: &'a mut Vec<CompileError>§refs: &'a mut RefSinkv0.25 (ADR 0053): binding edges recorded at the checker’s own resolution sites — capability/service dispatch, typed call dispatch, annotation resolution. Handler/test/provider bodies never pass through the resolver’s reference walk, so the checker is their only recording point.
hints: &'a mut HintSinkv0.27 (ADR 0056): inferred-type inlay hints recorded at the
annotation-absent binding sites (let / let <- / lambda params)
as the binding’s final type is computed.
locals: &'a mut LocalsSinkv0.31 (ADR 0064): local bindings recorded with their scope ranges at
every binding site (let/let <-, params, match patterns), for the
LSP’s scope-at-offset query.
requirements: &'a mut RequirementSinkv0.99: the capability-requirement ledger — every capability-consuming
site (direct call, store op), covered or not, recorded so the editor
surfaces (the ghost given inlay hint, hover) can read it.
scopes: Vec<HashMap<String, Ty>>Stack of in-scope name → type frames.
return_ty: Ty§return_ty_span: Span§effectful: boolTrue if the enclosing function/handler returns Effect[T] (v0.5).
Determines whether <- and capability calls are permitted.
agent_state_ty: Option<Ty>If inside an agent handler, the agent’s state type and the agent’s
name. Used to validate commit statements.
commit_seen: boolTrue if a commit has been seen on the current control-flow path.
Used to detect “two reachable commits”.
caps: CapabilityCtxCapability bookkeeping — the given-clause lifecycle + dispatch,
grouped (v0.29.10). Empty for pure functions / non-context code.
in_test_body: boolTrue when the body being checked is a test case body. Permits
expect statements (v0.7; renamed from assert in v0.112).
test_services: HashSet<String>The target unit’s service names, populated for test case bodies
(v0.25). svc.call(args) in a test invokes the target’s service —
the emitter wires it from the same set; the checker records the
binding edge here so test-file references index.
type_vars: HashSet<String>v0.20a: the enclosing function’s type parameters (rigid vars), so
nested explicit type arguments (identity[A](x) inside a generic
body) resolve. Empty outside generic fn bodies.
store_cells: HashMap<String, Ty>v0.81 (storage track): the agent’s store Cell fields (name → element
type). A := write resolves its target here and types its value against
the element type. Empty outside store-bearing agent handlers.
store_maps: HashMap<String, (Ty, Ty)>v0.82 (ADR 0110): the agent’s store Map fields (name → (key, value)).
A <map>.<op>(…) call resolves against the storage-map op set here, by
receiver provenance. Empty outside store-map agent handlers.
store_sets: HashMap<String, Ty>v0.83: the agent’s store Set fields (name → element). A <set>.<op>(…)
call resolves against the storage-set op set here, by receiver provenance.
store_caches: HashMap<String, (Ty, Ty, i64)>v0.87 (ADR 0113): the agent’s store Cache fields (name → (key, value,
ttl millis)). A <cache>.<op>(…) resolves against the cache op set and
requires given Clock.
store_logs: HashMap<String, Ty>v0.95 (ADR 0121): the agent’s store Log fields (name → element type).
<log>.append is the effectful non-idempotent write; the time-window
roots / builders lift the log into a lazy Query[T] over its values.
Implementations§
Source§impl<'a> Ctx<'a>
impl<'a> Ctx<'a>
pub fn lookup(&self, name: &str) -> Option<Ty>
Sourcepub fn lookup_root_ident(&self, expr: &Expr) -> Option<Ty>
pub fn lookup_root_ident(&self, expr: &Expr) -> Option<Ty>
Returns the type of an expression’s “root identifier” — for a.b.c
that’s a; for a bare a it’s a. Used to detect whether a chain’s
outermost name shadows an alias / consumed-context prefix.
pub fn push_scope(&mut self)
pub fn pop_scope(&mut self)
pub fn bind(&mut self, name: String, ty: Ty)
Auto Trait Implementations§
impl<'a> Freeze for Ctx<'a>
impl<'a> RefUnwindSafe for Ctx<'a>
impl<'a> Send for Ctx<'a>
impl<'a> Sync for Ctx<'a>
impl<'a> Unpin for Ctx<'a>
impl<'a> UnsafeUnpin for Ctx<'a>
impl<'a> !UnwindSafe for Ctx<'a>
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);