Trait SourceManager

Source
pub trait SourceManager: Debug {
Show 13 methods // Required methods fn load_from_raw_parts( &self, name: Arc<str>, content: SourceContent, ) -> Arc<SourceFile>; fn get(&self, id: SourceId) -> Result<Arc<SourceFile>, SourceManagerError>; fn find(&self, name: &str) -> Option<SourceId>; fn file_line_col_to_span(&self, loc: FileLineCol) -> Option<SourceSpan>; fn file_line_col( &self, span: SourceSpan, ) -> Result<FileLineCol, SourceManagerError>; fn location_to_span(&self, loc: Location) -> Option<SourceSpan>; fn location(&self, span: SourceSpan) -> Result<Location, SourceManagerError>; fn source(&self, id: SourceId) -> Result<&str, SourceManagerError>; fn source_slice(&self, span: SourceSpan) -> Result<&str, SourceManagerError>; // Provided methods fn is_manager_of(&self, file: &SourceFile) -> bool { ... } fn copy_into(&self, file: &SourceFile) -> Arc<SourceFile> { ... } fn load(&self, name: &str, content: String) -> Arc<SourceFile> { ... } fn get_by_path(&self, path: &str) -> Option<Arc<SourceFile>> { ... }
}

Required Methods§

Source

fn load_from_raw_parts( &self, name: Arc<str>, content: SourceContent, ) -> Arc<SourceFile>

Load content into this SourceManager from raw SourceFile components

Source

fn get(&self, id: SourceId) -> Result<Arc<SourceFile>, SourceManagerError>

Get the SourceFile corresponding to id

Source

fn find(&self, name: &str) -> Option<SourceId>

Search for a source file named name, and return its SourceId if found.

Source

fn file_line_col_to_span(&self, loc: FileLineCol) -> Option<SourceSpan>

Convert a FileLineCol to an equivalent SourceSpan, if the referenced file is available

Source

fn file_line_col( &self, span: SourceSpan, ) -> Result<FileLineCol, SourceManagerError>

Convert a SourceSpan to an equivalent FileLineCol, if the span is valid

Source

fn location_to_span(&self, loc: Location) -> Option<SourceSpan>

Convert a Location to an equivalent SourceSpan, if the referenced file is available

Source

fn location(&self, span: SourceSpan) -> Result<Location, SourceManagerError>

Convert a SourceSpan to an equivalent Location, if the span is valid

Source

fn source(&self, id: SourceId) -> Result<&str, SourceManagerError>

Get the source associated with id as a string slice

Source

fn source_slice(&self, span: SourceSpan) -> Result<&str, SourceManagerError>

Get the source corresponding to span as a string slice

Provided Methods§

Source

fn is_manager_of(&self, file: &SourceFile) -> bool

Returns true if file is managed by this source manager

Source

fn copy_into(&self, file: &SourceFile) -> Arc<SourceFile>

Copies file into this source manager (if not already managed by this manager).

The returned source file is guaranteed to be owned by this manager.

Source

fn load(&self, name: &str, content: String) -> Arc<SourceFile>

Load the given content into this SourceManager with name

Source

fn get_by_path(&self, path: &str) -> Option<Arc<SourceFile>>

Get the most recent SourceFile whose path is path

Implementations on Foreign Types§

Source§

impl<T> SourceManager for Arc<T>
where T: SourceManager + ?Sized,

Source§

fn is_manager_of(&self, file: &SourceFile) -> bool

Source§

fn copy_into(&self, file: &SourceFile) -> Arc<SourceFile>

Source§

fn load(&self, name: &str, content: String) -> Arc<SourceFile>

Source§

fn load_from_raw_parts( &self, name: Arc<str>, content: SourceContent, ) -> Arc<SourceFile>

Source§

fn get(&self, id: SourceId) -> Result<Arc<SourceFile>, SourceManagerError>

Source§

fn get_by_path(&self, path: &str) -> Option<Arc<SourceFile>>

Source§

fn find(&self, name: &str) -> Option<SourceId>

Source§

fn file_line_col_to_span(&self, loc: FileLineCol) -> Option<SourceSpan>

Source§

fn file_line_col( &self, span: SourceSpan, ) -> Result<FileLineCol, SourceManagerError>

Source§

fn location_to_span(&self, loc: Location) -> Option<SourceSpan>

Source§

fn location(&self, span: SourceSpan) -> Result<Location, SourceManagerError>

Source§

fn source(&self, id: SourceId) -> Result<&str, SourceManagerError>

Source§

fn source_slice(&self, span: SourceSpan) -> Result<&str, SourceManagerError>

Implementors§