pub struct SourceMap { /* private fields */ }Expand description
Where each code point of a normalised string came from in its source.
Filled by Normalizer::normalize_mapped. All positions are code-point
indices; utf8_range and utf16_range convert a range of the source
to bytes or UTF-16 units.
Implementations§
Source§impl SourceMap
impl SourceMap
Sourcepub fn source_len(&self) -> usize
pub fn source_len(&self) -> usize
Number of code points of the source.
Sourcepub fn source_of(&self, i: usize) -> Option<usize>
pub fn source_of(&self, i: usize) -> Option<usize>
The source code point that produced normalised code point i.
Sourcepub fn to_source(&self, range: Range<usize>) -> Option<Range<usize>>
pub fn to_source(&self, range: Range<usize>) -> Option<Range<usize>>
The smallest range of source code points that produced the normalised
code points range. It is extended at the end over source characters
that produced nothing (a dropped combining mark after the last letter
belongs to that letter). An empty range maps to an empty range at the
matching source position. None if range is not within
0..=self.len() or is reversed.
Trait Implementations§
impl Eq for SourceMap
impl StructuralPartialEq for SourceMap
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