Trait SourceWorld

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§

fn as_world(&self) -> &dyn World

Gets the world as a world.

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

Gets the path for a file id.

Provided Methods§

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

Gets the source by file id.

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

Gets the source range by span.

Implementors§

§

impl<F> SourceWorld for CompilerWorld<F>
where F: CompilerFeat,