pub struct SourceMap { /* private fields */ }Expand description
Where every token of the expanded stream came from.
Implementations§
Source§impl SourceMap
impl SourceMap
Sourcepub fn origin(&self, index: usize) -> Option<&Origin>
pub fn origin(&self, index: usize) -> Option<&Origin>
Where the token at index in the expanded stream came from.
Sourcepub fn original(&self, expanded: Span) -> Option<(FileId, Span)>
pub fn original(&self, expanded: Span) -> Option<(FileId, Span)>
Where a range of the expanded text was written: the file and the range in that file’s own text.
A range that starts inside a token written as it stands maps
octet for octet; one that starts inside a macro’s expansion maps
to the invocation, which is the text a reader can find. A range
over several tokens of one file runs from the first to the last;
one that leaves its file — a declaration whose body an include
supplied — keeps the file it starts in. None before the first
token, which a diagnostic of an empty unit points at.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SourceMap
impl RefUnwindSafe for SourceMap
impl Send for SourceMap
impl Sync for SourceMap
impl Unpin for SourceMap
impl UnsafeUnpin for SourceMap
impl UnwindSafe for SourceMap
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