pub struct Resolutions {
pub defs: Definitions,
pub res: HashMap<NodeId, Res>,
pub locals: HashMap<NodeId, Ident>,
pub node_defs: HashMap<NodeId, DefId>,
pub module_defs: Vec<DefId>,
pub repr_values: HashMap<DefId, i64>,
/* private fields */
}Expand description
The results of name resolution, keyed by AST node.
Fields§
§defs: Definitions§res: HashMap<NodeId, Res>What each path and each identifier pattern refers to. A pattern that
binds a variable resolves to Res::Local of itself.
locals: HashMap<NodeId, Ident>The name of each local variable, by the pattern that binds it.
node_defs: HashMap<NodeId, DefId>The definition created for each item, variant and generic parameter.
module_defs: Vec<DefId>The module definition of each loaded file, by ModuleIdx.
repr_values: HashMap<DefId, i64>Repr enum variants (native and xur-defined), keyed by their DefId.
Implementations§
Source§impl Resolutions
impl Resolutions
Source§impl Resolutions
impl Resolutions
Sourcepub fn empty() -> Self
pub fn empty() -> Self
Empty resolutions with no definitions. For lookups that only need the registry (no xur-defined types).
Sourcepub fn set_attribute(
&mut self,
target: AttrTarget,
name: Symbol,
value: Arc<dyn Any + Send + Sync>,
)
pub fn set_attribute( &mut self, target: AttrTarget, name: Symbol, value: Arc<dyn Any + Send + Sync>, )
Records the parsed value of a registered attribute on target.
Sourcepub fn attribute<T: Any>(&self, target: AttrTarget, name: &str) -> Option<&T>
pub fn attribute<T: Any>(&self, target: AttrTarget, name: &str) -> Option<&T>
The parsed value of attribute name on target, as its registered
type T (the #[derive(Facet)] type it was registered with).
Sourcepub fn def_path(&self, id: DefId) -> String
pub fn def_path(&self, id: DefId) -> String
The path a definition is known by, e.g. std::io::println,
math::div or Result::Ok. Items of the root module and the prelude
are written without a module prefix.
Sourcepub fn lookup(&self, scope: DefId, ns: Namespace, name: Symbol) -> Option<Res>
pub fn lookup(&self, scope: DefId, ns: Namespace, name: Symbol) -> Option<Res>
The binding of name in namespace ns declared directly in the
module or type scope.
Sourcepub fn assoc_fn(&self, ty: DefId, name: Symbol) -> Option<Res>
pub fn assoc_fn(&self, ty: DefId, name: Symbol) -> Option<Res>
The function name of the struct, enum or native type ty: from an
impl block, or registered with a native type. For dispatching
value.name() at runtime.
Sourcepub fn scope_entries(&self, scope: DefId, ns: Namespace) -> Vec<(Symbol, Res)>
pub fn scope_entries(&self, scope: DefId, ns: Namespace) -> Vec<(Symbol, Res)>
Every name declared in scope in namespace ns.
Sourcepub fn accessible_entries(
&self,
scope: DefId,
ns: Namespace,
from: DefId,
) -> Vec<(Symbol, Res)>
pub fn accessible_entries( &self, scope: DefId, ns: Namespace, from: DefId, ) -> Vec<(Symbol, Res)>
Every name declared in scope in namespace ns that may be named
from module from: all names when scope belongs to from, and
only the public ones otherwise. Mirrors the privacy check applied to
scope::name paths, so completion only offers reachable names.
Sourcepub fn root_module(&self, name: Symbol) -> Option<DefId>
pub fn root_module(&self, name: Symbol) -> Option<DefId>
The definition of a top-level root module by name (e.g. std).
Sourcepub fn root_modules(&self) -> impl Iterator<Item = (Symbol, DefId)> + '_
pub fn root_modules(&self) -> impl Iterator<Item = (Symbol, DefId)> + '_
All top-level root modules (currently native; will include packages).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Resolutions
impl !UnwindSafe for Resolutions
impl Forget for Resolutions
impl Freeze for Resolutionswhere
*const u8 is !null: Freeze,
PhantomData<DefData>: Freeze,
PhantomData<(NodeId, Res)>: Freeze,
PhantomData<(NodeId, Ident)>: Freeze,
PhantomData<(NodeId, DefId)>: Freeze,
PhantomData<DefId>: Freeze,
PhantomData<(DefId, Scope)>: Freeze,
PhantomData<(Symbol, DefId)>: Freeze,
PhantomData<(DefId, Vec<String>)>: Freeze,
PhantomData<(DefId, i64)>: Freeze,
PhantomData<(AttrTarget, HashMap<Symbol, Arc<dyn Any + Sync + Send>>)>: Freeze,
impl Move for Resolutions
impl Send for Resolutionswhere
RawVecInner: Send,
RawTable<(NodeId, Res)>: Send,
RawTable<(NodeId, Ident)>: Send,
RawTable<(NodeId, DefId)>: Send,
RawTable<(DefId, Scope)>: Send,
RawTable<(Symbol, DefId)>: Send,
RawTable<(DefId, Vec<String>)>: Send,
RawTable<(DefId, i64)>: Send,
RawTable<(AttrTarget, HashMap<Symbol, Arc<dyn Any + Sync + Send>>)>: Send,
impl Sync for Resolutionswhere
RawVecInner: Sync,
RawTable<(NodeId, Res)>: Sync,
RawTable<(NodeId, Ident)>: Sync,
RawTable<(NodeId, DefId)>: Sync,
RawTable<(DefId, Scope)>: Sync,
RawTable<(Symbol, DefId)>: Sync,
RawTable<(DefId, Vec<String>)>: Sync,
RawTable<(DefId, i64)>: Sync,
RawTable<(AttrTarget, HashMap<Symbol, Arc<dyn Any + Sync + Send>>)>: Sync,
impl Unpin for Resolutions
impl UnsafeUnpin for Resolutionswhere
*const u8 is !null: UnsafeUnpin,
PhantomData<DefData>: UnsafeUnpin,
PhantomData<(NodeId, Res)>: UnsafeUnpin,
PhantomData<(NodeId, Ident)>: UnsafeUnpin,
PhantomData<(NodeId, DefId)>: UnsafeUnpin,
PhantomData<DefId>: UnsafeUnpin,
PhantomData<(DefId, Scope)>: UnsafeUnpin,
PhantomData<(Symbol, DefId)>: UnsafeUnpin,
PhantomData<(DefId, Vec<String>)>: UnsafeUnpin,
PhantomData<(DefId, i64)>: UnsafeUnpin,
PhantomData<(AttrTarget, HashMap<Symbol, Arc<dyn Any + Sync + Send>>)>: UnsafeUnpin,
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
Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§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();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§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();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§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();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§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();Source§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>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§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);