pub struct DeriveIndex { /* private fields */ }Expand description
Index for fast derive trait validation.
§Memory Layout
DeriveIndex
├── symbol_derives: SecondaryMap<SymbolId, SmallVec<[String; 4]>>
│ └── struct/enum → derive trait names (e.g., ["Debug", "Clone"])
└── field_type_names: SecondaryMap<SymbolId, SmallVec<[String; 8]>>
└── struct/enum → field type names (for derive validation)Implementations§
Source§impl DeriveIndex
impl DeriveIndex
Sourcepub fn build(
ast_registry: &ASTRegistry,
code_graph: &CodeGraphV2,
typeflow: &TypeFlowGraphV2,
symbol_registry: &SymbolRegistry,
) -> Self
pub fn build( ast_registry: &ASTRegistry, code_graph: &CodeGraphV2, typeflow: &TypeFlowGraphV2, symbol_registry: &SymbolRegistry, ) -> Self
Build the index from ASTRegistry, CodeGraph, TypeFlow, and SymbolRegistry.
Sourcepub fn rebuild_all(
&mut self,
ast_registry: &ASTRegistry,
code_graph: &CodeGraphV2,
typeflow: &TypeFlowGraphV2,
symbol_registry: &SymbolRegistry,
)
pub fn rebuild_all( &mut self, ast_registry: &ASTRegistry, code_graph: &CodeGraphV2, typeflow: &TypeFlowGraphV2, symbol_registry: &SymbolRegistry, )
Rebuild the entire index.
Sourcepub fn rebuild_for_symbols(
&mut self,
symbols: &[SymbolId],
ast_registry: &ASTRegistry,
code_graph: &CodeGraphV2,
typeflow: &TypeFlowGraphV2,
symbol_registry: &SymbolRegistry,
)
pub fn rebuild_for_symbols( &mut self, symbols: &[SymbolId], ast_registry: &ASTRegistry, code_graph: &CodeGraphV2, typeflow: &TypeFlowGraphV2, symbol_registry: &SymbolRegistry, )
Incrementally update for specific symbols.
This is O(S) where S is the number of affected symbols, instead of O(N) for full rebuild.
Sourcepub fn iter_derives(
&self,
) -> impl Iterator<Item = (SymbolId, &SmallVec<[String; 4]>)>
pub fn iter_derives( &self, ) -> impl Iterator<Item = (SymbolId, &SmallVec<[String; 4]>)>
Iterate over all symbols and their derives.
Sourcepub fn get_derives(&self, id: SymbolId) -> Option<&SmallVec<[String; 4]>>
pub fn get_derives(&self, id: SymbolId) -> Option<&SmallVec<[String; 4]>>
Get derive traits for a symbol.
Sourcepub fn get_field_types(&self, id: SymbolId) -> Option<&SmallVec<[String; 8]>>
pub fn get_field_types(&self, id: SymbolId) -> Option<&SmallVec<[String; 8]>>
Get field type names for a symbol.
Sourcepub fn has_derive(&self, id: SymbolId, trait_name: &str) -> bool
pub fn has_derive(&self, id: SymbolId, trait_name: &str) -> bool
Check if a symbol has a specific derive trait.
Sourcepub fn symbols_deriving(&self, trait_name: &str) -> Vec<SymbolId>
pub fn symbols_deriving(&self, trait_name: &str) -> Vec<SymbolId>
Get all symbols that derive a specific trait.
Sourcepub fn stats(&self) -> DeriveIndexStats
pub fn stats(&self) -> DeriveIndexStats
Get statistics about the index.
Trait Implementations§
Source§impl Clone for DeriveIndex
impl Clone for DeriveIndex
Source§fn clone(&self) -> DeriveIndex
fn clone(&self) -> DeriveIndex
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DeriveIndex
impl Debug for DeriveIndex
Source§impl Default for DeriveIndex
impl Default for DeriveIndex
Source§fn default() -> DeriveIndex
fn default() -> DeriveIndex
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for DeriveIndex
impl RefUnwindSafe for DeriveIndex
impl Send for DeriveIndex
impl Sync for DeriveIndex
impl Unpin for DeriveIndex
impl UnsafeUnpin for DeriveIndex
impl UnwindSafe for DeriveIndex
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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 more