Struct ra_ap_vfs::Vfs

source ·
pub struct Vfs { /* private fields */ }
Expand description

Storage for all file changes and the file id to path mapping.

For more information see the crate-level documentation.

Implementations§

source§

impl Vfs

source

pub fn file_id(&self, path: &VfsPath) -> Option<FileId>

Id of the given path if it exists in the Vfs and is not deleted.

source

pub fn file_path(&self, file_id: FileId) -> &VfsPath

File path corresponding to the given file_id.

§Panics

Panics if the id is not present in the Vfs.

source

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.

source

pub fn set_file_contents( &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.

source

pub fn take_changes(&mut self) -> Vec<ChangedFile>

Drain and returns all the changes in the Vfs.

source

pub fn exists(&self, file_id: FileId) -> bool

Provides a panic-less way to verify file_id validity.

Trait Implementations§

source§

impl Debug for Vfs

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Vfs

source§

fn default() -> Vfs

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Vfs

§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.