pub struct FieldPath {
pub base_var: String,
pub indices: Vec<usize>,
}Expand description
Represents a path to a specific field within a struct hierarchy
Examples:
_1.0→ base_var=“_1”, indices=[0]_1.1.2→ base_var=“_1”, indices=[1, 2]_3→ base_var=“_3”, indices=[] (whole variable)
Fields§
§base_var: StringBase variable name (e.g., “_1”, “_3”, “_10”)
indices: Vec<usize>Field indices from root to leaf Empty vec means the entire variable (not a specific field)
Implementations§
Source§impl FieldPath
impl FieldPath
Sourcepub fn whole_var(base_var: String) -> Self
pub fn whole_var(base_var: String) -> Self
Create a field path for an entire variable (no field access)
Sourcepub fn single_field(base_var: String, index: usize) -> Self
pub fn single_field(base_var: String, index: usize) -> Self
Create a field path from a base and single field index
Sourcepub fn to_string(&self) -> String
pub fn to_string(&self) -> String
Convert to canonical string representation Examples: “_1” , “_1.0”, “_1.1.2”
Sourcepub fn is_prefix_of(&self, other: &FieldPath) -> bool
pub fn is_prefix_of(&self, other: &FieldPath) -> bool
Check if this path is a prefix of another path
Example: _1.1 is a prefix of _1.1.2
Example: _1 is a prefix of _1.0
Example: _1.2 is NOT a prefix of _1.1.2
Sourcepub fn is_whole_var(&self) -> bool
pub fn is_whole_var(&self) -> bool
Check if this is a whole variable (no field indices)
Trait Implementations§
impl Eq for FieldPath
impl StructuralPartialEq for FieldPath
Auto Trait Implementations§
impl Freeze for FieldPath
impl RefUnwindSafe for FieldPath
impl Send for FieldPath
impl Sync for FieldPath
impl Unpin for FieldPath
impl UnsafeUnpin for FieldPath
impl UnwindSafe for FieldPath
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<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
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more