Struct moore_common::source::SourceManager
[−]
[src]
pub struct SourceManager { /* fields omitted */ }
A manager for source files and their assigned IDs.
Methods
impl SourceManager
[src]
fn with<F, R>(&self, id: Source, f: F) -> R where
F: FnOnce(&SourceFile) -> R,
[src]
F: FnOnce(&SourceFile) -> R,
Obtain the source file for a given source ID.
fn find<Q: ?Sized>(&self, filename: &Q) -> Option<Source> where
RcStr: Borrow<Q>,
Q: Eq + Hash,
[src]
RcStr: Borrow<Q>,
Q: Eq + Hash,
fn open(&self, filename: &str) -> Option<Source>
[src]
fn add(&self, filename: &str, content: &str) -> Source
[src]
Create a virtual file from the contents of a string and add it to the
source manager. Future calls to open()
with the given filename will
yield the provided contents.
fn add_anonymous<S>(&self, content: S) -> Source where
S: Into<String>,
[src]
S: Into<String>,
Create a virtual file from the contents of a string and add it to the
source manager. The file can only be used with the returned Source
,
since there is no name associated with it by which it could be referred
to.