pub struct SessionGraph { /* private fields */ }Expand description
A delta-based semantic graph for a single session workspace.
Lookups resolve in order: removed -> modified -> added -> base. This gives each session a consistent, isolated view of the symbol graph without copying the entire base.
Implementations§
Source§impl SessionGraph
impl SessionGraph
Sourcepub fn fork_from(base: Arc<ArcSwap<HashMap<SymbolId, Symbol>>>) -> Self
pub fn fork_from(base: Arc<ArcSwap<HashMap<SymbolId, Symbol>>>) -> Self
Fork from a shared base symbol table.
Sourcepub fn get_symbol(&self, id: SymbolId) -> Option<Symbol>
pub fn get_symbol(&self, id: SymbolId) -> Option<Symbol>
Look up a symbol by ID, respecting the session delta.
Resolution order:
- If removed in this session, return
None. - If modified in this session, return the modified version.
- If added in this session, return it.
- Fall through to the shared base.
Sourcepub fn add_symbol(&self, symbol: Symbol)
pub fn add_symbol(&self, symbol: Symbol)
Add a new symbol to this session.
Sourcepub fn modify_symbol(&self, symbol: Symbol)
pub fn modify_symbol(&self, symbol: Symbol)
Modify an existing symbol (base or previously added).
Sourcepub fn remove_symbol(&self, id: SymbolId)
pub fn remove_symbol(&self, id: SymbolId)
Remove a symbol from the session view.
Sourcepub fn remove_edge(&self, edge_id: Uuid)
pub fn remove_edge(&self, edge_id: Uuid)
Remove a call edge.
Sourcepub fn changed_symbol_names(&self) -> Vec<String>
pub fn changed_symbol_names(&self) -> Vec<String>
Return the names of all symbols changed in this session (added, modified, or removed).
Used by the conflict detector to find overlapping changes.
Sourcepub fn update_from_parse(
&self,
_file_path: &str,
new_symbols: Vec<Symbol>,
base_symbols_for_file: &[Symbol],
)
pub fn update_from_parse( &self, _file_path: &str, new_symbols: Vec<Symbol>, base_symbols_for_file: &[Symbol], )
Update the session graph from a parse result for a single file.
Compares the new symbols against the base symbols for that file, and classifies each as added, modified, or removed within the session delta.
base_symbols_for_file should contain all symbols from the base
that belong to the given file path.
Sourcepub fn changed_symbols_for_file(&self, file_path: &str) -> Vec<String>
pub fn changed_symbols_for_file(&self, file_path: &str) -> Vec<String>
Return the names of symbols changed in this session that belong to the given file path. Useful for cross-session file awareness.
Sourcepub fn change_count(&self) -> usize
pub fn change_count(&self) -> usize
Number of symbols changed (added + modified + removed).
Auto Trait Implementations§
impl Freeze for SessionGraph
impl !RefUnwindSafe for SessionGraph
impl Send for SessionGraph
impl Sync for SessionGraph
impl Unpin for SessionGraph
impl UnsafeUnpin for SessionGraph
impl UnwindSafe for SessionGraph
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for 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 more