pub struct Snapshot {
pub ast: Ast,
pub interner: Arc<ThreadedRodeo>,
pub sources: FxHashMap<FileId, WorkspaceFile>,
pub path_to_file_id: FxHashMap<PathBuf, FileId>,
pub line_maps: FxHashMap<FileId, LineMap>,
pub type_pool: Option<Arc<TypeInternPool>>,
pub expr_types: FxHashMap<Span, Type>,
}Expand description
Successful compile snapshot (sema completed even if errors were reported).
The LSP keeps the most recent Snapshot available via ArcSwap so that
hover/goto/references can serve queries while a new compile is in flight.
Fields§
§ast: Ast§interner: Arc<ThreadedRodeo>Shared interner used to resolve identifiers from the AST.
Phase 1 only walks the AST for hover/goto; the interner is owned here
so later phases can re-resolve Spurs without re-parsing.
sources: FxHashMap<FileId, WorkspaceFile>File contents at the time this snapshot was captured.
path_to_file_id: FxHashMap<PathBuf, FileId>Source path -> file_id reverse map.
line_maps: FxHashMap<FileId, LineMap>Line maps for each open file.
type_pool: Option<Arc<TypeInternPool>>Type intern pool from sema. Owned so format_type_name works for
hover queries.
expr_types: FxHashMap<Span, Type>Phase 4 side-table: span → result type for every AIR instruction
produced during sema. Built post-analysis by walking
AnalyzedFunction.air so we don’t have to instrument sema.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Snapshot
impl !RefUnwindSafe for Snapshot
impl Send for Snapshot
impl Sync for Snapshot
impl Unpin for Snapshot
impl UnsafeUnpin for Snapshot
impl !UnwindSafe for Snapshot
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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