pub struct ResolvedCommons {
pub commons: Commons,
pub types: HashMap<String, Arc<TypeDecl>>,
pub fns: HashMap<String, Arc<FnDecl>>,
pub methods: HashMap<String, MethodTable>,
pub cross_context: CrossContextInfo,
pub agents: HashMap<String, AgentDecl>,
pub imported_from: HashMap<String, String>,
pub is_context: bool,
/* private fields */
}Expand description
Output of resolution: the AST plus the symbol tables the checker needs.
Fields§
§commons: Commons§types: HashMap<String, Arc<TypeDecl>>Finding #10/#51: Arc-wrapped (not owned) so cloning this map — done
once per synthetic per-handler ResolvedCommons during emission — is
a pointer bump, not a deep copy of every declaration body in the unit.
fns: HashMap<String, Arc<FnDecl>>Finding #10/#51: Arc-wrapped for the same reason as types.
methods: HashMap<String, MethodTable>Per-type method tables (instance + static).
cross_context: CrossContextInfoCross-context call information for v0.6. None for commons and for
single-file mode. For contexts, supplies the set of consumed contexts
and any aliases introduced via consumes ... as Alias.
agents: HashMap<String, AgentDecl>Agents declared in this context. Used to recognise the Agent(key)
construction shape and the agent_instance.handler(args) method-call
shape in handler bodies that mention other agents.
imported_from: HashMap<String, String>v0.91 (ADR 0116 D6): for each imported function name, the qualified unit
it came from (map → bynk.list). Lets the checker flag deprecated
first-party free functions at their call sites. Empty in single-file
mode and in synthetic handler-validation resolveds.
is_context: boolTrue iff this unit is a context (as opposed to a commons, adapter, or
test/integration scaffold). bynk-check has no dependency on
bynk-emit’s UnitKind, so callers set this directly from their own
unit-kind knowledge. Used to gate the context-rebrand construction
check (#907): only a context’s emission rebrands a uses-sourced
commons sum type’s variant constructors out of value scope.
Implementations§
Source§impl ResolvedCommons
impl ResolvedCommons
Sourcepub fn is_local_type(&self, name: &str) -> bool
pub fn is_local_type(&self, name: &str) -> bool
Returns true if name is a type declared in the current commons
(rather than imported via uses). Local types alone may reach into
their opaque representation (.raw) or call .unsafe(value).
Sourcepub fn is_local_event(&self, name: &str) -> bool
pub fn is_local_event(&self, name: &str) -> bool
Events track, slice 0: is name a declared event in this commons —
not merely any local type?
Sourcepub fn is_uses_commons_type(&self, name: &str) -> bool
pub fn is_uses_commons_type(&self, name: &str) -> bool
Is name in scope via uses of a commons specifically? See
uses_commons_type_names’s field doc for the exact predicate.
Sourcepub fn new(
commons: Commons,
types: HashMap<String, Arc<TypeDecl>>,
local_types: &HashMap<String, Arc<TypeDecl>>,
fns: HashMap<String, Arc<FnDecl>>,
methods: HashMap<String, MethodTable>,
agents: HashMap<String, AgentDecl>,
local_events: &HashMap<String, EventDecl>,
cross_context: CrossContextInfo,
imported_from: HashMap<String, String>,
is_context: bool,
uses_commons_type_names: HashSet<String>,
) -> Self
pub fn new( commons: Commons, types: HashMap<String, Arc<TypeDecl>>, local_types: &HashMap<String, Arc<TypeDecl>>, fns: HashMap<String, Arc<FnDecl>>, methods: HashMap<String, MethodTable>, agents: HashMap<String, AgentDecl>, local_events: &HashMap<String, EventDecl>, cross_context: CrossContextInfo, imported_from: HashMap<String, String>, is_context: bool, uses_commons_type_names: HashSet<String>, ) -> Self
Build a ResolvedCommons from a merged (local + uses/consumes)
symbol table, deriving local_type_names/event_type_names from
local_types/local_events — the pre-merge tables — rather than
from types/agents (already merged). This is the one thing every
hand-rolled construction outside this crate got a chance to disagree
on: the pre-merge/merged distinction is exactly what backs
.raw/.unsafe()/owner-only-event-emission gating, and reusing the
merged table there silently widens all three to any consumed/used
type or event (found during the events track, slice 0, spine #936).
Auto Trait Implementations§
impl Freeze for ResolvedCommons
impl RefUnwindSafe for ResolvedCommons
impl Send for ResolvedCommons
impl Sync for ResolvedCommons
impl Unpin for ResolvedCommons
impl UnsafeUnpin for ResolvedCommons
impl UnwindSafe for ResolvedCommons
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);