pub struct SuggestStore { /* private fields */ }Expand description
Manages suggestion lifecycle in sync with AnalysisContext
Implementations§
Source§impl SuggestStore
impl SuggestStore
Sourcepub fn insert(&mut self, suggestion: StoredSuggestion) -> Option<SuggestId>
pub fn insert(&mut self, suggestion: StoredSuggestion) -> Option<SuggestId>
Insert a new suggestion, returning its ID.
Returns None if an active (non-closed) suggestion with the same
(pattern, opportunity_id) already exists (dedup).
Sourcepub fn get(&self, id: SuggestId) -> Option<&StoredSuggestion>
pub fn get(&self, id: SuggestId) -> Option<&StoredSuggestion>
Get a suggestion by ID (returns None if invalid, stale, or closed)
Sourcepub fn get_mut(&mut self, id: SuggestId) -> Option<&mut StoredSuggestion>
pub fn get_mut(&mut self, id: SuggestId) -> Option<&mut StoredSuggestion>
Get a mutable reference to a suggestion by ID
Sourcepub fn remove_for_symbol(&mut self, symbol: &SymbolId)
pub fn remove_for_symbol(&mut self, symbol: &SymbolId)
Remove all suggestions for a deleted symbol
Sourcepub fn invalidate_for_symbol(&mut self, symbol: &SymbolId)
pub fn invalidate_for_symbol(&mut self, symbol: &SymbolId)
Invalidate (bump generation) for all suggestions targeting a modified symbol
Sourcepub fn current_generation(&self, id: SuggestId) -> Option<u32>
pub fn current_generation(&self, id: SuggestId) -> Option<u32>
Get the current generation for a suggestion ID’s index
Sourcepub fn close(&mut self, id: SuggestId, reason: impl Into<String>) -> bool
pub fn close(&mut self, id: SuggestId, reason: impl Into<String>) -> bool
Mark a suggestion as closed
Sourcepub fn iter(&self) -> impl Iterator<Item = (SuggestId, &StoredSuggestion)>
pub fn iter(&self) -> impl Iterator<Item = (SuggestId, &StoredSuggestion)>
Iterate over all active suggestions
Sourcepub fn total_count(&self) -> usize
pub fn total_count(&self) -> usize
Total number of suggestions (including closed)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SuggestStore
impl RefUnwindSafe for SuggestStore
impl Send for SuggestStore
impl Sync for SuggestStore
impl Unpin for SuggestStore
impl UnsafeUnpin for SuggestStore
impl UnwindSafe for SuggestStore
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> 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>
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