Skip to main content

SourceManager

Trait SourceManager 

pub trait SourceManager: Debug {
Show 14 methods // Required methods fn load_from_raw_parts( &self, name: Uri, content: SourceContent, ) -> Arc<SourceFile>; fn update( &self, id: SourceId, text: String, range: Option<Selection>, version: i32, ) -> Result<(), SourceManagerError>; fn get(&self, id: SourceId) -> Result<Arc<SourceFile>, SourceManagerError>; fn find(&self, uri: &Uri) -> 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, lang: SourceLanguage, name: Uri, content: String, ) -> Arc<SourceFile> { ... } fn get_by_uri(&self, uri: &Uri) -> Option<Arc<SourceFile>> { ... }
}

Required Methods§

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

Load content into this SourceManager from raw SourceFile components

fn update( &self, id: SourceId, text: String, range: Option<Selection>, version: i32, ) -> Result<(), SourceManagerError>

Update the source file corresponding to id after being notified of a change event.

The version indicates the new version of the document

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

Get the SourceFile corresponding to id

fn find(&self, uri: &Uri) -> Option<SourceId>

Search for a source file whose URI is uri, and return its SourceId if found.

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

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

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

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

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

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

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

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

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

Get the source associated with id as a string slice

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

Get the source corresponding to span as a string slice

Provided Methods§

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

Returns true if file is managed by this source manager

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.

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

Load the given content into this SourceManager with name

fn get_by_uri(&self, uri: &Uri) -> Option<Arc<SourceFile>>

Get the most recent SourceFile whose URI is uri

Implementations on Foreign Types§

§

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

§

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

§

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

§

fn load( &self, lang: SourceLanguage, uri: Uri, content: String, ) -> Arc<SourceFile>

§

fn load_from_raw_parts( &self, uri: Uri, content: SourceContent, ) -> Arc<SourceFile>

§

fn update( &self, id: SourceId, text: String, range: Option<Selection>, version: i32, ) -> Result<(), SourceManagerError>

§

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

§

fn get_by_uri(&self, uri: &Uri) -> Option<Arc<SourceFile>>

§

fn find(&self, uri: &Uri) -> 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>

Implementors§