pub struct Vfs { /* private fields */ }Expand description
Storage for all files read by rust-analyzer.
For more information see the crate-level documentation.
Implementations
sourceimpl Vfs
impl Vfs
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Amount of files currently stored.
Note that this includes deleted files.
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 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more