pub struct MirDb { /* private fields */ }Expand description
Concrete in-process Salsa database.
Clone is required for parallel batch analysis: salsa’s supported
pattern for sharing a db across threads is to give each worker its
own clone (each clone gets a fresh ZalsaLocal, sharing the
underlying memoization storage). Sharing &MirDb across threads is
not supported because salsa::Database: Send (not Sync).
Implementations§
Source§impl MirDb
impl MirDb
Sourcepub fn upsert_class_node(&mut self, fields: ClassNodeFields) -> ClassNode
pub fn upsert_class_node(&mut self, fields: ClassNodeFields) -> ClassNode
Create or update the ClassNode for fqcn.
If a handle already exists, its fields are updated in-place so Salsa can track the change. A new handle is created only on first registration.
Sourcepub fn deactivate_class_node(&mut self, fqcn: &str)
pub fn deactivate_class_node(&mut self, fqcn: &str)
Mark the ClassNode for fqcn as inactive.
Dependent class_ancestors queries will observe the change and re-run,
returning an empty list.
Sourcepub fn upsert_function_node(
&mut self,
storage: &FunctionStorage,
) -> FunctionNode
pub fn upsert_function_node( &mut self, storage: &FunctionStorage, ) -> FunctionNode
Create or update the FunctionNode for the given FunctionStorage.
Sourcepub fn commit_inferred_return_types(&mut self, buf: &InferredReturnTypes)
pub fn commit_inferred_return_types(&mut self, buf: &InferredReturnTypes)
Commit a parallel-sweep-collected InferredReturnTypes buffer
into the Salsa db. Must be called serially, after all rayon
workers from the priming sweep have dropped their db clones, so
that Storage::cancel_others sees strong-count==1 inside the
setter. Calling this from inside a for_each_with / map_with
closure will deadlock.
Skips writes whose value already matches the current Salsa-tracked value (preserves PR21’s fast-skip semantics). Skips inactive nodes — there’s no point committing an inferred return for a node that has been deactivated by a re-analyze.
Sourcepub fn deactivate_function_node(&mut self, fqn: &str)
pub fn deactivate_function_node(&mut self, fqn: &str)
Mark the FunctionNode for fqn as inactive.
Sourcepub fn upsert_method_node(&mut self, storage: &MethodStorage) -> MethodNode
pub fn upsert_method_node(&mut self, storage: &MethodStorage) -> MethodNode
Create or update the MethodNode for (storage.fqcn, storage.name.to_lowercase()).
Sourcepub fn deactivate_class_methods(&mut self, fqcn: &str)
pub fn deactivate_class_methods(&mut self, fqcn: &str)
Mark all MethodNodes owned by fqcn as inactive.
Sourcepub fn prune_class_methods(
&mut self,
fqcn: &str,
keep_lower: &HashSet<Arc<str>>,
)
pub fn prune_class_methods( &mut self, fqcn: &str, keep_lower: &HashSet<Arc<str>>, )
Deactivate MethodNodes for fqcn whose lowercased name is not in
keep_lower. Used by ingest_codebase to prune stale stub methods
when a user file shadows a bundled-stub class with a different method
set. Active-only check preserves PR21’s fast-skip — already-inactive
nodes don’t fire a setter.
Sourcepub fn prune_class_properties(&mut self, fqcn: &str, keep: &HashSet<Arc<str>>)
pub fn prune_class_properties(&mut self, fqcn: &str, keep: &HashSet<Arc<str>>)
Deactivate PropertyNodes for fqcn whose name is not in keep.
Sourcepub fn prune_class_constants(&mut self, fqcn: &str, keep: &HashSet<Arc<str>>)
pub fn prune_class_constants(&mut self, fqcn: &str, keep: &HashSet<Arc<str>>)
Deactivate ClassConstantNodes for fqcn whose name is not in keep.
Sourcepub fn upsert_property_node(
&mut self,
fqcn: &Arc<str>,
storage: &PropertyStorage,
)
pub fn upsert_property_node( &mut self, fqcn: &Arc<str>, storage: &PropertyStorage, )
Create or update the PropertyNode for (storage.fqcn, storage.name).
Sourcepub fn deactivate_class_properties(&mut self, fqcn: &str)
pub fn deactivate_class_properties(&mut self, fqcn: &str)
Mark all PropertyNodes owned by fqcn as inactive.
Sourcepub fn upsert_class_constant_node(
&mut self,
fqcn: &Arc<str>,
storage: &ConstantStorage,
)
pub fn upsert_class_constant_node( &mut self, fqcn: &Arc<str>, storage: &ConstantStorage, )
Create or update the ClassConstantNode for (fqcn, storage.name).
Sourcepub fn ingest_codebase(&mut self, codebase: &Codebase)
pub fn ingest_codebase(&mut self, codebase: &Codebase)
Walk every entry in codebase and upsert the corresponding db node.
Used after bundled / user stubs are loaded into Codebase so that
type_exists_via_db / class_kind_via_db / class_template_params_via_db
see them too. Idempotent — re-running upserts existing nodes in place
without invalidating downstream queries when fields are unchanged.
Sourcepub fn upsert_global_constant_node(
&mut self,
fqn: Arc<str>,
ty: Union,
) -> GlobalConstantNode
pub fn upsert_global_constant_node( &mut self, fqn: Arc<str>, ty: Union, ) -> GlobalConstantNode
Create or update the GlobalConstantNode for fqn.
Sourcepub fn deactivate_global_constant_node(&mut self, fqn: &str)
pub fn deactivate_global_constant_node(&mut self, fqn: &str)
Mark the GlobalConstantNode for fqn as inactive.
Sourcepub fn deactivate_class_constants(&mut self, fqcn: &str)
pub fn deactivate_class_constants(&mut self, fqcn: &str)
Mark all ClassConstantNodes owned by fqcn as inactive.
Trait Implementations§
Source§impl Database for MirDb
impl Database for MirDb
Source§fn trigger_lru_eviction(&mut self)
fn trigger_lru_eviction(&mut self)
Source§fn synthetic_write(&mut self, durability: Durability)
fn synthetic_write(&mut self, durability: Durability)
durability has changed, triggering a new revision.
This is mostly useful for profiling scenarios. Read moreSource§fn trigger_cancellation(&mut self)
fn trigger_cancellation(&mut self)
Source§fn cancellation_token(&self) -> CancellationToken
fn cancellation_token(&self) -> CancellationToken
CancellationToken for the current database handle.Source§fn report_untracked_read(&self)
fn report_untracked_read(&self)
Source§fn ingredient_debug_name(
&self,
ingredient_index: IngredientIndex,
) -> Cow<'_, str>
fn ingredient_debug_name( &self, ingredient_index: IngredientIndex, ) -> Cow<'_, str>
Source§fn unwind_if_revision_cancelled(&self)
fn unwind_if_revision_cancelled(&self)
Source§impl MirDatabase for MirDb
impl MirDatabase for MirDb
Source§fn lookup_function_node(&self, fqn: &str) -> Option<FunctionNode>
fn lookup_function_node(&self, fqn: &str) -> Option<FunctionNode>
FunctionNode handle registered for fqn, if any.Source§fn lookup_method_node(
&self,
fqcn: &str,
method_name_lower: &str,
) -> Option<MethodNode>
fn lookup_method_node( &self, fqcn: &str, method_name_lower: &str, ) -> Option<MethodNode>
Source§fn lookup_property_node(
&self,
fqcn: &str,
prop_name: &str,
) -> Option<PropertyNode>
fn lookup_property_node( &self, fqcn: &str, prop_name: &str, ) -> Option<PropertyNode>
PropertyNode for (fqcn, prop_name), if any.Source§fn lookup_class_constant_node(
&self,
fqcn: &str,
const_name: &str,
) -> Option<ClassConstantNode>
fn lookup_class_constant_node( &self, fqcn: &str, const_name: &str, ) -> Option<ClassConstantNode>
ClassConstantNode for (fqcn, const_name), if any.Source§fn lookup_global_constant_node(&self, fqn: &str) -> Option<GlobalConstantNode>
fn lookup_global_constant_node(&self, fqn: &str) -> Option<GlobalConstantNode>
GlobalConstantNode for fqn, if any.Source§fn class_own_methods(&self, fqcn: &str) -> Vec<MethodNode>
fn class_own_methods(&self, fqcn: &str) -> Vec<MethodNode>
fqcn. Empty if no class is
registered. Untracked iteration of a per-class HashMap.Source§fn class_own_properties(&self, fqcn: &str) -> Vec<PropertyNode>
fn class_own_properties(&self, fqcn: &str) -> Vec<PropertyNode>
fqcn. Empty if no class is
registered. Untracked iteration of a per-class HashMap.Auto Trait Implementations§
impl !Freeze for MirDb
impl RefUnwindSafe for MirDb
impl Send for MirDb
impl !Sync for MirDb
impl Unpin for MirDb
impl UnsafeUnpin for MirDb
impl !UnwindSafe for MirDb
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more