pub struct IndexVariantRef {
pub variant: ResolvedIndexVariant,
pub index_span: Option<Span>,
pub variant_span: Span,
}Expand description
A resolved index-variant reference with the source spans of its two written segments kept separate.
The index segment and the variant segment are not necessarily adjacent:
table desugaring reuses the table[Axis] axis token’s span as the index
span of every row key, so a single merged span would cover unrelated
source (and make different rows’ spans contain each other). Keeping the
segments separate lets diagnostics on contiguous Index.Variant paths
use the whole written path (IndexVariantRef::path_span) while
span-precise consumers (rename, find-references) address exactly the
variant segment.
Fields§
§variant: ResolvedIndexVariantThe resolved index variant.
index_span: Option<Span>Span of the index path as written (Maneuver in Maneuver.Departure,
or the axis token inside table[...] for desugared table rows).
None when the variant is written without an index segment (a bare
label in a match pattern whose index is inferred).
variant_span: SpanSpan of just the variant segment (the final path segment / row label).
Implementations§
Source§impl IndexVariantRef
impl IndexVariantRef
Sourcepub fn path_span(&self) -> Span
pub fn path_span(&self) -> Span
Whole-reference span for diagnostics on contiguous Index.Variant
paths. For desugared table rows the index segment lives inside
table[...], so prefer Self::variant_span there.
Trait Implementations§
Source§impl Clone for IndexVariantRef
impl Clone for IndexVariantRef
Source§fn clone(&self) -> IndexVariantRef
fn clone(&self) -> IndexVariantRef
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for IndexVariantRef
impl Debug for IndexVariantRef
impl Eq for IndexVariantRef
Source§impl PartialEq for IndexVariantRef
impl PartialEq for IndexVariantRef
Source§fn eq(&self, other: &IndexVariantRef) -> bool
fn eq(&self, other: &IndexVariantRef) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for IndexVariantRef
Auto Trait Implementations§
impl Freeze for IndexVariantRef
impl RefUnwindSafe for IndexVariantRef
impl Send for IndexVariantRef
impl Sync for IndexVariantRef
impl Unpin for IndexVariantRef
impl UnsafeUnpin for IndexVariantRef
impl UnwindSafe for IndexVariantRef
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.