rem_extract/startup/
mod.rs

1//! This module is responsible for the startup information needed for the
2//! extractor to have context about the binary being analyzed.
3//! It build out a Workspace around std / core, and then we extend that
4//! workspace with our single file to allow for 90% of the features of
5//! Rust-Analyzer to work properly. Crucially this allows the extract method to
6//! get much better type information about the code being analyzed.
7//!
8
9use std::sync::OnceLock;
10
11pub mod types;
12pub mod context;
13pub mod identify; 
14
15use types::SingleFileStdContext;
16use context::build_single_file_std_context;
17
18static SINGLE_FILE_STD_CTX: OnceLock<SingleFileStdContext> = OnceLock::new();
19
20pub fn single_file_std_context() -> &'static SingleFileStdContext {
21    SINGLE_FILE_STD_CTX.get_or_init(|| {
22        build_single_file_std_context().expect("failed to init single-file std context")
23    })
24}