[][src]Struct ra_ap_vfs::Vfs

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]

File path corresponding to the given file_id.

Panics

Panics if the id is not present in the Vfs.

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]

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

impl Debug for Vfs[src]

impl Default for Vfs[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.