pub struct FileIdMap { /* private fields */ }Expand description
Bidirectional mapping between file paths and stable FileIds.
IDs are assigned sequentially on first contact. The mapping is append-only within a session; IDs are never recycled.
Implementations§
Source§impl FileIdMap
impl FileIdMap
pub fn new() -> Self
Sourcepub fn assign_or_get(&mut self, path: &str) -> FileId
pub fn assign_or_get(&mut self, path: &str) -> FileId
Return the FileId for path, assigning a fresh one if not yet seen.
Sourcepub fn get(&self, path: &str) -> Option<FileId>
pub fn get(&self, path: &str) -> Option<FileId>
Look up the FileId for path without assigning a new one.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FileIdMap
impl RefUnwindSafe for FileIdMap
impl Send for FileIdMap
impl Sync for FileIdMap
impl Unpin for FileIdMap
impl UnsafeUnpin for FileIdMap
impl UnwindSafe for FileIdMap
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