pub struct SourceManager { /* private fields */ }
Expand description
A manager for source files and their assigned IDs.
Implementations§
Source§impl SourceManager
impl SourceManager
Sourcepub fn with<F, R>(&self, id: Source, f: F) -> Rwhere
F: FnOnce(&dyn SourceFile) -> R,
pub fn with<F, R>(&self, id: Source, f: F) -> Rwhere
F: FnOnce(&dyn SourceFile) -> R,
Obtain the source file for a given source ID.
pub fn find<Q>(&self, filename: &Q) -> Option<Source>
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
pub fn add_anonymous<S>(&self, content: S) -> Source
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 !Freeze for SourceManager
impl !RefUnwindSafe for SourceManager
impl !Send for SourceManager
impl !Sync for SourceManager
impl Unpin for SourceManager
impl !UnwindSafe for SourceManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more