pub struct SourceMap<SourceIndex, TargetIndex> { /* private fields */ }
Expand description
A SourceMap provides information necessary to understand which parts of a target were derived from which parts of a source artifact, in such a way that they can be mapped in either direction.
The behavior of such mappings depends on the implementations of the generic Index
types,
but this may be a many-to-many mapping, where one element of the source is mapped (contributes)
to zero or many elements of the target, and vice versa.
This is also intended to be mergeable in a chain, such that the combined result of a series of transformations can be expressed within a single source mapping.
Implementations§
Source§impl<SourceIndex, TargetIndex> SourceMap<SourceIndex, TargetIndex>
impl<SourceIndex, TargetIndex> SourceMap<SourceIndex, TargetIndex>
Sourcepub fn list_sources<QueryIndex>(
&self,
target_index: &QueryIndex,
) -> Vec<&SourceIndex>where
TargetIndex: SourceMapIndexable<QueryIndex>,
pub fn list_sources<QueryIndex>(
&self,
target_index: &QueryIndex,
) -> Vec<&SourceIndex>where
TargetIndex: SourceMapIndexable<QueryIndex>,
Return all source ranges in the source map which were used to generate the target range.
This is O(n)
where n
is the number of entries in the map.
Sourcepub fn list_targets<QueryIndex>(
&self,
source_index: &QueryIndex,
) -> Vec<&TargetIndex>where
SourceIndex: SourceMapIndexable<QueryIndex>,
pub fn list_targets<QueryIndex>(
&self,
source_index: &QueryIndex,
) -> Vec<&TargetIndex>where
SourceIndex: SourceMapIndexable<QueryIndex>,
Return all target ranges in the source map which were used to generate the source range.
This is O(n)
where n
is the number of entries in the map.
Trait Implementations§
Source§impl<SourceIndex: PartialEq, TargetIndex: PartialEq> PartialEq for SourceMap<SourceIndex, TargetIndex>
impl<SourceIndex: PartialEq, TargetIndex: PartialEq> PartialEq for SourceMap<SourceIndex, TargetIndex>
impl<SourceIndex, TargetIndex> StructuralPartialEq for SourceMap<SourceIndex, TargetIndex>
Auto Trait Implementations§
impl<SourceIndex, TargetIndex> Freeze for SourceMap<SourceIndex, TargetIndex>
impl<SourceIndex, TargetIndex> RefUnwindSafe for SourceMap<SourceIndex, TargetIndex>where
SourceIndex: RefUnwindSafe,
TargetIndex: RefUnwindSafe,
impl<SourceIndex, TargetIndex> Send for SourceMap<SourceIndex, TargetIndex>
impl<SourceIndex, TargetIndex> Sync for SourceMap<SourceIndex, TargetIndex>
impl<SourceIndex, TargetIndex> Unpin for SourceMap<SourceIndex, TargetIndex>
impl<SourceIndex, TargetIndex> UnwindSafe for SourceMap<SourceIndex, TargetIndex>where
SourceIndex: UnwindSafe,
TargetIndex: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.