#[non_exhaustive]pub enum VarSegment {
Field(String),
Index(i64),
Key(String),
Dynamic(String),
Slice(Option<i64>, Option<i64>),
}Expand description
A segment in a variable path.
The first segment of a path is the root name, carried as Field. Every
later segment is a bracket subscript. A Field in a non-root position
represents a dotted .field access, which — kaish being brackets-only —
resolves to a loud error with the bracket form in the message.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Field(String)
The root variable name, or (illegally, past the root) a dotted .field.
Index(i64)
Integer subscript [0] / [-1] — indexes a list (negative from the end).
Key(String)
Literal key [bareword] or ["quoted key"] — keys a record.
Dynamic(String)
Dynamic subscript [$var] — the named variable’s value is the key
(record) or index (list) at resolution time. Holds the variable name.
Slice(Option<i64>, Option<i64>)
Slice [a:b] — end-exclusive, yields a list. Either bound may be omitted.
Trait Implementations§
Source§impl Clone for VarSegment
impl Clone for VarSegment
Source§fn clone(&self) -> VarSegment
fn clone(&self) -> VarSegment
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for VarSegment
impl Debug for VarSegment
Source§impl PartialEq for VarSegment
impl PartialEq for VarSegment
impl StructuralPartialEq for VarSegment
Auto Trait Implementations§
impl Freeze for VarSegment
impl RefUnwindSafe for VarSegment
impl Send for VarSegment
impl Sync for VarSegment
impl Unpin for VarSegment
impl UnsafeUnpin for VarSegment
impl UnwindSafe for VarSegment
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
impl<T> OrderedSeq<'_, T> for Twhere
T: Clone,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
Source§impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
Source§fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
Invokes
WrappingSpan::make_wrapped to wrap an AST node in a span.