pub struct Vfs { /* private fields */ }Expand description
Storage for all files read by rust-analyzer.
For more information see the crate-level documentation.
Implementations§
source§impl Vfs
impl Vfs
sourcepub fn file_id(&self, path: &VfsPath) -> Option<FileId>
pub fn file_id(&self, path: &VfsPath) -> Option<FileId>
Id of the given path if it exists in the Vfs and is not deleted.
sourcepub fn file_contents(&self, file_id: FileId) -> &[u8] ⓘ
pub fn file_contents(&self, file_id: FileId) -> &[u8] ⓘ
File content corresponding to the given file_id.
Panics
Panics if the id is not present in the Vfs, or if the corresponding file is
deleted.
sourcepub fn memory_usage(&self) -> usize
pub fn memory_usage(&self) -> usize
Returns the overall memory usage for the stored files.
sourcepub fn iter(&self) -> impl Iterator<Item = (FileId, &VfsPath)> + '_
pub fn iter(&self) -> impl Iterator<Item = (FileId, &VfsPath)> + '_
Returns an iterator over the stored ids and their corresponding paths.
This will skip deleted files.
sourcepub fn has_changes(&self) -> bool
pub fn has_changes(&self) -> bool
Returns true if the Vfs contains changes.
sourcepub fn take_changes(&mut self) -> Vec<ChangedFile>
pub fn take_changes(&mut self) -> Vec<ChangedFile>
Drain and returns all the changes in the Vfs.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Vfs
impl Send for Vfs
impl Sync for Vfs
impl Unpin for Vfs
impl UnwindSafe for Vfs
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