pub enum ProjSegment {
Index(i32),
Key(Value),
}Expand description
One path-projection segment (docs/format-v4-rfc.md §1: segments: 0 = index i32, 1 = key value). Segment kind 2 = range is RESERVED and never
constructed in T1e (icebox #829 — sequence slices/ranges).
The kind recorded here is a wire-compactness choice, not a semantic
tag the walker trusts blindly: an evaluated segment value that happens to
be an Int is captured as Index (the compact i32 form);
everything else — a map key of another scalar type, or a struct field
name (always a Value::String literal) — is captured as
Key. Walking dispatches on the root’s current container
type at each step (spec §4: reads walk against the root’s current
value), so an Index(n) segment applied to a Map is reinterpreted as
MapKey::Int(n) — the distinction never forecloses either domain.
Variants§
Index(i32)
[i] — captured because the evaluated segment value was an Int.
Key(Value)
[k] (a non-Int map key) or .field (a struct field name,
captured as Value::String).
Implementations§
Source§impl ProjSegment
impl ProjSegment
Sourcepub fn from_value(v: Value) -> Self
pub fn from_value(v: Value) -> Self
Trait Implementations§
Source§impl Clone for ProjSegment
impl Clone for ProjSegment
Source§fn clone(&self) -> ProjSegment
fn clone(&self) -> ProjSegment
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more