Trait source_map::FileSystem

source ·
pub trait FileSystem: Sized {
    // Required methods
    fn new_source_id_with_line_starts(
        &mut self,
        path: PathBuf,
        content: String
    ) -> (SourceId, LineStarts);
    fn get_source_by_id<T, F: for<'a> FnOnce(&'a Source) -> T>(
        &self,
        source_id: SourceId,
        f: F
    ) -> T;

    // Provided methods
    fn new_source_id(&mut self, path: PathBuf, content: String) -> SourceId { ... }
    fn get_file_path_and_content(
        &self,
        source_id: SourceId
    ) -> (PathBuf, String) { ... }
    fn get_file_path(&self, source_id: SourceId) -> PathBuf { ... }
    fn get_file_content(&self, source_id: SourceId) -> String { ... }
    fn get_file_whole_span(&self, source_id: SourceId) -> SpanWithSource { ... }
    fn get_file_slice<I: SliceIndex<str>>(
        &self,
        source_id: SourceId,
        indexer: I
    ) -> Option<<I::Output as ToOwned>::Owned>
       where I::Output: Sized + ToOwned { ... }
}

Required Methods§

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

Provided Methods§

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

Object Safety§

This trait is not object safe.

Implementors§