Struct moore_common::source::SourceManager
source · [−]pub struct SourceManager { /* private fields */ }
Expand description
A manager for source files and their assigned IDs.
Implementations
sourceimpl SourceManager
impl SourceManager
sourcepub fn with<F, R>(&self, id: Source, f: F) -> R where
F: FnOnce(&dyn SourceFile) -> R,
pub fn with<F, R>(&self, id: Source, f: F) -> R where
F: FnOnce(&dyn SourceFile) -> R,
Obtain the source file for a given source ID.
pub fn find<Q: ?Sized>(&self, filename: &Q) -> Option<Source> where
RcStr: Borrow<Q>,
Q: Eq + Hash,
pub fn open(&self, filename: &str) -> Option<Source>
sourcepub fn add(&self, filename: &str, content: &str) -> Source
pub fn add(&self, filename: &str, content: &str) -> Source
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.
sourcepub fn add_anonymous<S>(&self, content: S) -> Source where
S: Into<String>,
pub fn add_anonymous<S>(&self, content: S) -> Source where
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.
Auto Trait Implementations
impl !RefUnwindSafe for SourceManager
impl !Send for SourceManager
impl !Sync for SourceManager
impl Unpin for SourceManager
impl !UnwindSafe for SourceManager
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more