Struct Vfs

Source
pub struct Vfs<U = ()>(/* private fields */);

Implementations§

Source§

impl<U> Vfs<U>

Source

pub fn new() -> Vfs<U>

Creates a new, empty VFS.

Source

pub fn file_saved(&self, path: &Path) -> Result<(), Error>

Indicate that the current file as known to the VFS has been written to disk.

Source

pub fn flush_file(&self, path: &Path) -> Result<(), Error>

Removes a file from the VFS. Does not check if the file is synced with the disk. Does not check if the file exists.

Source

pub fn file_is_synced(&self, path: &Path) -> Result<bool, Error>

Source

pub fn on_changes(&self, changes: &[Change]) -> Result<(), Error>

Record a set of changes to the VFS.

Source

pub fn get_cached_files(&self) -> HashMap<PathBuf, String>

Return all files in the VFS.

Source

pub fn get_changes(&self) -> HashMap<PathBuf, String>

Source

pub fn has_changes(&self) -> bool

Returns true if the VFS contains any changed files.

Source

pub fn set_file(&self, path: &Path, text: &str)

Source

pub fn load_file(&self, path: &Path) -> Result<FileContents, Error>

Source

pub fn load_line( &self, path: &Path, line: Row<ZeroIndexed>, ) -> Result<String, Error>

Source

pub fn load_lines( &self, path: &Path, line_start: Row<ZeroIndexed>, line_end: Row<ZeroIndexed>, ) -> Result<String, Error>

Source

pub fn load_span(&self, span: Span<ZeroIndexed>) -> Result<String, Error>

Source

pub fn for_each_line<F>(&self, path: &Path, f: F) -> Result<(), Error>
where F: FnMut(&str, usize) -> Result<(), Error>,

Source

pub fn write_file(&self, path: &Path) -> Result<(), Error>

Source

pub fn set_user_data(&self, path: &Path, data: Option<U>) -> Result<(), Error>

Source

pub fn with_user_data<F, R>(&self, path: &Path, f: F) -> Result<R, Error>
where F: FnOnce(Result<(Option<&str>, &mut U), Error>) -> Result<R, Error>,

Source

pub fn ensure_user_data<F>(&self, path: &Path, f: F) -> Result<(), Error>
where F: FnOnce(Option<&str>) -> Result<U, Error>,

Source

pub fn clear(&self)

Auto Trait Implementations§

§

impl<U = ()> !Freeze for Vfs<U>

§

impl<U> RefUnwindSafe for Vfs<U>

§

impl<U> Send for Vfs<U>
where U: Send,

§

impl<U> Sync for Vfs<U>
where U: Send,

§

impl<U> Unpin for Vfs<U>
where U: Unpin,

§

impl<U> UnwindSafe for Vfs<U>

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>,

Source§

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>,

Source§

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.