pub struct ResolvedCommons {Show 13 fields
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,
pub assets: HashMap<String, AssetDecl>,
pub embeds: HashMap<String, EmbedDecl>,
pub shadowed_imports: HashMap<String, ShadowedImport>,
pub extensible_enums: HashSet<String>,
pub stability: UnitStability,
/* 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.
assets: HashMap<String, AssetDecl>#1883, slice 1a: every asset visible in this unit — its own and its
usesd commons’ (crate::assets::compose_unit_assets). An asset
name is a value of type Asset. Empty unless set with
ResolvedCommons::with_assets.
embeds: HashMap<String, EmbedDecl>#2387, slice 1: every embed visible in this unit — its own and its
usesd commons’ (crate::embeds::compose_unit_embeds). An embed
name is a String value. Empty unless set with
ResolvedCommons::with_embeds.
shadowed_imports: HashMap<String, ShadowedImport>#1925: the uses-imported values this unit’s own declarations of
another kind shadow, by name. Empty unless set with
ResolvedCommons::with_shadowed_imports; read through
ResolvedCommons::shadowed_import_error.
extensible_enums: HashSet<String>Standard-library S3 (#1963): the names in scope that are a first-party
unit’s extensible enums (FetchError, Method), whose match needs a
wildcard. Types carry no owning unit, so this is decided once per unit
from its provenance (check_pipeline) and carried to every check built
from it. Empty unless set with ResolvedCommons::with_extensible_enums.
stability: UnitStabilityStandard-library S3 (#1963): the unit’s stability facts — the project’s
[unstable] policy and the imports it blocks. Set with
ResolvedCommons::with_stability; the default blocks nothing.
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).
Sourcepub fn with_assets(self, assets: HashMap<String, AssetDecl>) -> Self
pub fn with_assets(self, assets: HashMap<String, AssetDecl>) -> Self
#1883, slice 1a: the assets visible in this unit. A builder rather
than a ResolvedCommons::new parameter, so the constructions that
can never see an asset (a synthetic test scaffold) need not mention
them.
Sourcepub fn with_embeds(self, embeds: HashMap<String, EmbedDecl>) -> Self
pub fn with_embeds(self, embeds: HashMap<String, EmbedDecl>) -> Self
#2387, slice 1: the embeds visible in this unit, a builder like
ResolvedCommons::with_assets.
Sourcepub fn with_shadowed_imports(
self,
shadowed: HashMap<String, ShadowedImport>,
) -> Self
pub fn with_shadowed_imports( self, shadowed: HashMap<String, ShadowedImport>, ) -> Self
#1925: the uses-imported values this unit’s own declarations of
another kind shadow (crate::project_model::shadowed_imports).
Sourcepub fn with_extensible_enums(self, names: HashSet<String>) -> Self
pub fn with_extensible_enums(self, names: HashSet<String>) -> Self
S3 (#1963): set ResolvedCommons::extensible_enums.
Sourcepub fn with_stability(self, stability: UnitStability) -> Self
pub fn with_stability(self, stability: UnitStability) -> Self
S3 (#1963): set ResolvedCommons::stability.
Sourcepub fn shadowed_import_error(
&self,
name: &str,
span: Span,
) -> Option<CompileError>
pub fn shadowed_import_error( &self, name: &str, span: Span, ) -> Option<CompileError>
#1925: the conflict to report for a reference to name that the
unit’s own declaration could not answer, when name is a shadowed
import — or None, and the caller reports its usual diagnostic.
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);