pub struct SourceMap { /* private fields */ }Expand description
Cache of file contents and line indices, keyed by canonical path.
Used by the loader and the exporter — the exporter renders spans against
the original bytes; eviction is therefore off until the consumer signals
otherwise. Internally backed by a RwLock<HashMap> (rare writes, frequent
reads); DashMap is overkill for the loader’s call pattern (one writer
per file, then read-only).
Implementations§
Source§impl SourceMap
impl SourceMap
Sourcepub fn get(&self, path: &Path) -> Option<Arc<str>>
pub fn get(&self, path: &Path) -> Option<Arc<str>>
Look up cached contents for path. Returns None if not cached.
Sourcepub fn insert(&self, path: &Path, src: Arc<str>) -> Arc<str>
pub fn insert(&self, path: &Path, src: Arc<str>) -> Arc<str>
Insert (or overwrite) the cached contents for path. Returns the
Arc<str> the caller should use going forward.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SourceMap
impl RefUnwindSafe for SourceMap
impl Send for SourceMap
impl Sync for SourceMap
impl Unpin for SourceMap
impl UnsafeUnpin for SourceMap
impl UnwindSafe for SourceMap
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