Struct Mappings

Source
pub struct Mappings<O = ()>
where O: Observer,
{ /* private fields */ }
Expand description

A parsed set of mappings that can be queried.

Constructed via parse_mappings.

Implementations§

Source§

impl<O: Observer> Mappings<O>

Source

pub fn by_generated_location(&self) -> &[Mapping]

Get the full set of mappings, ordered by generated location.

Source

pub fn compute_column_spans(&mut self)

Compute the last generated column of each mapping.

After this method has been called, any mappings with last_generated_column == None means that the mapping spans to the end of the line.

Source

pub fn by_original_source(&mut self, source: u32) -> &[Mapping]

Get the set of mappings that have original location information for the given source and ordered by original location.

Source

pub fn by_original_location( &mut self, ) -> ByOriginalLocation<'_, O::SortByOriginalLocation>

Iterate over all mappings that contain original location information, sorted by their original location information.

Source

pub fn original_location_for( &self, generated_line: u32, generated_column: u32, bias: Bias, ) -> Option<&Mapping>

Get the mapping closest to the given generated location, if any exists.

Source

pub fn generated_location_for( &mut self, source: u32, original_line: u32, original_column: u32, bias: Bias, ) -> Option<&Mapping>

Get the mapping closest to the given original location, if any exists.

Source

pub fn all_generated_locations_for( &mut self, source: u32, original_line: u32, original_column: Option<u32>, ) -> AllGeneratedLocationsFor<'_>

Get all mappings at the given original location.

If original_column is None, get all mappings on the given source and original line regardless what columns they have. If original_column is Some, only return mappings for which all of source, original line, and original column match.

Trait Implementations§

Source§

impl<O> Debug for Mappings<O>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<O: Observer> Default for Mappings<O>

Source§

fn default() -> Mappings<O>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<O> Freeze for Mappings<O>
where O: Freeze,

§

impl<O> RefUnwindSafe for Mappings<O>

§

impl<O> Send for Mappings<O>

§

impl<O> Sync for Mappings<O>

§

impl<O> Unpin for Mappings<O>

§

impl<O> UnwindSafe for Mappings<O>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T, F> ComparatorFunction<Option<T>> for F
where F: ComparatorFunction<T>,

Source§

fn compare(a: &Option<T>, b: &Option<T>) -> Ordering

Compare the given values.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.