Struct MapFileStore

Source
pub struct MapFileStore<T> { /* private fields */ }

Implementations§

Source§

impl<T: PathMap> MapFileStore<T>

Source

pub fn update_file(&mut self, id: SourceId, content: String)

Source

pub fn append_to_file(&mut self, id: SourceId, content: &str) -> (usize, usize)

Returns the OLD and NEW length of the file’s content

Source§

impl MapFileStore<WithPathMap>

Source

pub fn update_file_at_path(&mut self, path: &Path, content: String)

Updates an existing entry

TODO partial updates

Source

pub fn get_source_at_path(&self, path: &Path) -> Option<SourceId>

Returns a possible SourceId for a path

Source

pub fn change_file_path(&mut self, from: &Path, to: PathBuf)

Either a rename or move. Must already exist

Source

pub fn create_or_update_file_at_path(&mut self, path: &Path, content: String)

Source

pub fn get_paths(&self) -> &HashMap<PathBuf, SourceId>

Trait Implementations§

Source§

impl<T: Default> Default for MapFileStore<T>

Source§

fn default() -> MapFileStore<T>

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

impl<M: PathMap> FileSystem for MapFileStore<M>

Source§

fn new_source_id_with_line_starts( &mut self, path: PathBuf, content: String, ) -> (SourceId, LineStarts)

Source§

fn get_source_by_id<T, F: for<'a> FnOnce(&'a Source) -> T>( &self, source_id: SourceId, f: F, ) -> T

Source§

fn new_source_id(&mut self, path: PathBuf, content: String) -> SourceId

Generate a new SourceId
Source§

fn get_file_path_and_content(&self, source_id: SourceId) -> (PathBuf, String)

Source§

fn get_file_path(&self, source_id: SourceId) -> PathBuf

Source§

fn get_file_content(&self, source_id: SourceId) -> String

Source§

fn get_file_whole_span(&self, source_id: SourceId) -> SpanWithSource

Source§

fn get_file_slice<I: SliceIndex<str>>( &self, source_id: SourceId, indexer: I, ) -> Option<<I::Output as ToOwned>::Owned>
where I::Output: Sized + ToOwned,

Note that this does clone the result

Auto Trait Implementations§

§

impl<T> Freeze for MapFileStore<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for MapFileStore<T>
where T: RefUnwindSafe,

§

impl<T> Send for MapFileStore<T>
where T: Send,

§

impl<T> Sync for MapFileStore<T>
where T: Sync,

§

impl<T> Unpin for MapFileStore<T>
where T: Unpin,

§

impl<T> UnwindSafe for MapFileStore<T>
where T: UnwindSafe,

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.