pub struct VariantPath(/* private fields */);Expand description
A path through nested union variants (e.g., “ok.some.left” -> [ok, some, left]).
Used for parsing and validating nested unions with $variant extension.
Implementations§
Source§impl VariantPath
impl VariantPath
Sourcepub fn new(segments: Vec<Identifier>) -> Self
pub fn new(segments: Vec<Identifier>) -> Self
Create a new VariantPath from a vector of identifiers.
Sourcepub fn parse(s: &str) -> Result<Self, IdentifierError>
pub fn parse(s: &str) -> Result<Self, IdentifierError>
Parse a variant path from a dotted string (e.g., “ok.some.left”).
Sourcepub fn first(&self) -> Option<&Identifier>
pub fn first(&self) -> Option<&Identifier>
Get the first segment.
Sourcepub fn segments(&self) -> &[Identifier]
pub fn segments(&self) -> &[Identifier]
Get the segments as a slice.
Trait Implementations§
Source§impl Clone for VariantPath
impl Clone for VariantPath
Source§fn clone(&self) -> VariantPath
fn clone(&self) -> VariantPath
Returns a duplicate of the value. Read more
1.0.0 · 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 VariantPath
impl Debug for VariantPath
Source§impl Display for VariantPath
impl Display for VariantPath
Source§impl FromStr for VariantPath
impl FromStr for VariantPath
Source§impl PartialEq for VariantPath
impl PartialEq for VariantPath
impl Eq for VariantPath
impl StructuralPartialEq for VariantPath
Auto Trait Implementations§
impl Freeze for VariantPath
impl RefUnwindSafe for VariantPath
impl Send for VariantPath
impl Sync for VariantPath
impl Unpin for VariantPath
impl UnwindSafe for VariantPath
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.