pub struct SourceSet { /* private fields */ }Expand description
Owns the source documents retained for one compilation.
A source set is mutable while callers build a parse-only compilation, but it cannot be cloned into independently mutable arenas whose future IDs would alias. Resolved MIBs and diagnostic reports share one internal arena.
ⓘ
use mib_rs::SourceSet;
let sources = SourceSet::new();
let fork = sources.clone();Implementations§
Source§impl SourceSet
impl SourceSet
Sourcepub fn insert(
&mut self,
origin: SourceOrigin,
label: impl Into<Arc<str>>,
bytes: Arc<[u8]>,
) -> Result<SourceId, SourceRangeError>
pub fn insert( &mut self, origin: SourceOrigin, label: impl Into<Arc<str>>, bytes: Arc<[u8]>, ) -> Result<SourceId, SourceRangeError>
Retain a source document and return its compilation-local identity.
Sourcepub fn get(&self, id: SourceId) -> Option<&SourceDocument>
pub fn get(&self, id: SourceId) -> Option<&SourceDocument>
Return a retained document by its compilation-local identity.
Sourcepub fn iter(&self) -> impl ExactSizeIterator<Item = &SourceDocument>
pub fn iter(&self) -> impl ExactSizeIterator<Item = &SourceDocument>
Iterate over retained documents in identity allocation order.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SourceSet
impl RefUnwindSafe for SourceSet
impl Send for SourceSet
impl Sync for SourceSet
impl Unpin for SourceSet
impl UnsafeUnpin for SourceSet
impl UnwindSafe for SourceSet
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