pub struct SymbolRefDb { /* private fields */ }Implementations§
Source§impl SymbolRefDb
impl SymbolRefDb
pub fn new() -> Self
pub fn with_inner( self, inner: IndexVec<ModuleIdx, Option<SymbolRefDbForModule>>, ) -> Self
Sourcepub fn is_facade_symbol(&self, refer: SymbolRef) -> bool
pub fn is_facade_symbol(&self, refer: SymbolRef) -> bool
The facade means the symbol does not actually exist in the original AST.
§Panics
- If the module does not exist in the symbol database.
Sourcepub fn clone_without_scoping(&self) -> SymbolRefDb
pub fn clone_without_scoping(&self) -> SymbolRefDb
Clone the symbol ref DB for caching, using an empty Scoping to avoid
expensive cloning. After each build, merge_from_build restores the
authoritative Scoping and extends classic_data for facade symbols.
Source§impl SymbolRefDb
impl SymbolRefDb
pub fn into_inner(self) -> IndexVec<ModuleIdx, Option<SymbolRefDbForModule>>
pub fn inner(&self) -> &IndexVec<ModuleIdx, Option<SymbolRefDbForModule>>
pub fn store_local_db( &mut self, module_idx: ModuleIdx, local_db: SymbolRefDbForModule, )
Sourcepub fn has_module_preserve_jsx(&self) -> bool
pub fn has_module_preserve_jsx(&self) -> bool
Returns whether any module uses JSX preserve mode.
Sourcepub fn set_has_module_preserve_jsx(&mut self)
pub fn set_has_module_preserve_jsx(&mut self)
Mark that at least one module uses JSX preserve mode.
This is used as a fast-path optimization in link().
pub fn create_facade_root_symbol_ref( &mut self, owner: ModuleIdx, name: &str, ) -> SymbolRef
pub fn canonical_name_for<'name>( &self, refer: SymbolRef, canonical_names: &'name FxHashMap<SymbolRef, CompactStr>, ) -> Option<&'name CompactStr>
Sourcepub fn canonical_name_for_or_original<'a>(
&'a self,
refer: SymbolRef,
canonical_names: &'a FxHashMap<SymbolRef, CompactStr>,
) -> &'a str
pub fn canonical_name_for_or_original<'a>( &'a self, refer: SymbolRef, canonical_names: &'a FxHashMap<SymbolRef, CompactStr>, ) -> &'a str
Get the canonical name for a symbol, falling back to the original name if not renamed. This is more efficient than storing original names in canonical_names map.
Sourcepub fn original_name(&self, canonical_ref: SymbolRef) -> CompactStr
pub fn original_name(&self, canonical_ref: SymbolRef) -> CompactStr
The owned pre-deconfliction name for an already-canonical symbol: its name,
but with the first character upper-cased when module.preserve_jsx is enabled
and the symbol is a JSX component binding that must start with a capital letter
(e.g. foo -> Foo). This is the base name the renamer feeds into conflict
resolution.
pub fn get(&self, refer: SymbolRef) -> &SymbolRefDataClassic
pub fn get_mut(&mut self, refer: SymbolRef) -> &mut SymbolRefDataClassic
Sourcepub fn find_mut(&mut self, target: SymbolRef) -> SymbolRef
pub fn find_mut(&mut self, target: SymbolRef) -> SymbolRef
https://en.wikipedia.org/wiki/Disjoint-set_data_structure See Path halving
pub fn canonical_ref_for(&self, target: SymbolRef) -> SymbolRef
Sourcepub fn canonical_ref_resolving_namespace(
&self,
symbol_ref: SymbolRef,
) -> SymbolRef
pub fn canonical_ref_resolving_namespace( &self, symbol_ref: SymbolRef, ) -> SymbolRef
Resolves a symbol reference to its canonical form, following namespace aliases.
pub fn is_declared_in_root_scope(&self, refer: SymbolRef) -> bool
Sourcepub fn get_create_reason(&self, symbol_ref: &SymbolRef) -> &str
pub fn get_create_reason(&self, symbol_ref: &SymbolRef) -> &str
If it is not a facade symbol, No create reason found will be returned.
Trait Implementations§
Source§impl Debug for SymbolRefDb
impl Debug for SymbolRefDb
Source§impl Default for SymbolRefDb
impl Default for SymbolRefDb
Source§fn default() -> SymbolRefDb
fn default() -> SymbolRefDb
Source§impl GetLocalDb for SymbolRefDb
impl GetLocalDb for SymbolRefDb
fn local_db(&self, owner: ModuleIdx) -> &SymbolRefDbForModule
Source§impl GetLocalDbMut for SymbolRefDb
impl GetLocalDbMut for SymbolRefDb
fn local_db_mut(&mut self, owner: ModuleIdx) -> &mut SymbolRefDbForModule
Source§impl Index<ModuleIdx> for SymbolRefDb
impl Index<ModuleIdx> for SymbolRefDb
Auto Trait Implementations§
impl !RefUnwindSafe for SymbolRefDb
impl !UnwindSafe for SymbolRefDb
impl Freeze for SymbolRefDb
impl Send for SymbolRefDb
impl Sync for SymbolRefDb
impl Unpin for SymbolRefDb
impl UnsafeUnpin for SymbolRefDb
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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);