Struct ra_ap_vfs::Vfs [−][src]
pub struct Vfs { /* fields omitted */ }
Storage for all files read by rust-analyzer.
For more informations see the crate-level documentation.
Implementations
impl Vfs
[src]
pub fn len(&self) -> usize
[src]
Amount of files currently stored.
Note that this includes deleted files.
pub fn file_id(&self, path: &VfsPath) -> Option<FileId>
[src]
Id of the given path if it exists in the Vfs
and is not deleted.
pub fn file_path(&self, file_id: FileId) -> VfsPath
[src]
pub fn file_contents(&self, file_id: FileId) -> &[u8]
[src]
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.
pub fn iter(&self) -> impl Iterator<Item = (FileId, &VfsPath)> + '_
[src]
Returns an iterator over the stored ids and their corresponding paths.
This will skip deleted files.
pub fn set_file_contents(
&mut self,
path: VfsPath,
contents: Option<Vec<u8>>
) -> bool
[src]
&mut self,
path: VfsPath,
contents: Option<Vec<u8>>
) -> bool
Update the path
with the given contents
. None
means the file was deleted.
Returns true
if the file was modified, and saves the change.
If the path does not currently exists in the Vfs
, allocates a new
FileId
for it.
pub fn has_changes(&self) -> bool
[src]
Returns true
if the Vfs
contains changes.
pub fn take_changes(&mut self) -> Vec<ChangedFile>
[src]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,