pub trait SourceWorld: World {
// Required methods
fn as_world(&self) -> &dyn World;
fn path_for_id(&self, id: FileId) -> Result<PathResolution, FileError>;
// Provided methods
fn lookup(&self, id: FileId) -> Source { ... }
fn source_range(&self, span: Span) -> Option<Range<usize>> { ... }
}
Expand description
A world that can be used for source code reporting.
Required Methods§
Sourcefn path_for_id(&self, id: FileId) -> Result<PathResolution, FileError>
fn path_for_id(&self, id: FileId) -> Result<PathResolution, FileError>
Gets the path for a file id.
Provided Methods§
Sourcefn source_range(&self, span: Span) -> Option<Range<usize>>
fn source_range(&self, span: Span) -> Option<Range<usize>>
Gets the source range by span.