pub struct Mapping {
pub generated_line: u32,
pub generated_column: u32,
pub source_index: Option<u32>,
pub original_line: Option<u32>,
pub original_column: Option<u32>,
pub name_index: Option<u32>,
}Expand description
A single mapping entry in a source map.
Each mapping describes how a generated position maps back to an original position in a source file.
Fields§
§generated_line: u32Generated line (0-indexed).
generated_column: u32Generated column (0-indexed).
source_index: Option<u32>Source file index (if this mapping has a source).
original_line: Option<u32>Original line (0-indexed, if this mapping has a source).
original_column: Option<u32>Original column (0-indexed, if this mapping has a source).
name_index: Option<u32>Name index (if this mapping has a name).
Implementations§
Source§impl Mapping
impl Mapping
Sourcepub fn generated_only(line: u32, column: u32) -> Self
pub fn generated_only(line: u32, column: u32) -> Self
Creates a new mapping with only generated position.
Sourcepub fn full(
generated_line: u32,
generated_column: u32,
source_index: u32,
original_line: u32,
original_column: u32,
name_index: Option<u32>,
) -> Self
pub fn full( generated_line: u32, generated_column: u32, source_index: u32, original_line: u32, original_column: u32, name_index: Option<u32>, ) -> Self
Creates a new mapping with full information.
Sourcepub fn has_source(&self) -> bool
pub fn has_source(&self) -> bool
Checks if this mapping has source information.
Sourcepub fn source_index_or_zero(&self) -> u32
pub fn source_index_or_zero(&self) -> u32
Returns the source index, or 0 if none.
Sourcepub fn original_line_or_zero(&self) -> u32
pub fn original_line_or_zero(&self) -> u32
Returns the original line, or 0 if none.
Sourcepub fn original_column_or_zero(&self) -> u32
pub fn original_column_or_zero(&self) -> u32
Returns the original column, or 0 if none.
Sourcepub fn name_index_or_zero(&self) -> u32
pub fn name_index_or_zero(&self) -> u32
Returns the name index, or 0 if none.
Trait Implementations§
Source§impl Ord for Mapping
impl Ord for Mapping
Source§impl PartialOrd for Mapping
impl PartialOrd for Mapping
impl Copy for Mapping
impl Eq for Mapping
impl StructuralPartialEq for Mapping
Auto Trait Implementations§
impl Freeze for Mapping
impl RefUnwindSafe for Mapping
impl Send for Mapping
impl Sync for Mapping
impl Unpin for Mapping
impl UnsafeUnpin for Mapping
impl UnwindSafe for Mapping
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