Trait SourceWorld

Source
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§

Source

fn as_world(&self) -> &dyn World

Gets the world as a world.

Source

fn path_for_id(&self, id: FileId) -> Result<PathResolution, FileError>

Gets the path for a file id.

Provided Methods§

Source

fn lookup(&self, id: FileId) -> Source

Gets the source by file id.

Source

fn source_range(&self, span: Span) -> Option<Range<usize>>

Gets the source range by span.

Implementors§