pub struct SolPath(/* private fields */);
Expand description
A list of identifiers, separated by dots.
This is never parsed as empty.
Implementations§
Methods from Deref<Target = Punctuated<SolIdent, Dot>>§
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Determines whether this punctuated sequence is empty, meaning it contains no syntax tree nodes or punctuation.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of syntax tree nodes in this punctuated sequence.
This is the number of nodes of type T
, not counting the punctuation of
type P
.
Sourcepub fn first_mut(&mut self) -> Option<&mut T>
pub fn first_mut(&mut self) -> Option<&mut T>
Mutably borrows the first element in this sequence.
Sourcepub fn last_mut(&mut self) -> Option<&mut T>
pub fn last_mut(&mut self) -> Option<&mut T>
Mutably borrows the last element in this sequence.
Sourcepub fn get_mut(&mut self, index: usize) -> Option<&mut T>
pub fn get_mut(&mut self, index: usize) -> Option<&mut T>
Mutably borrows the element at the given index.
Sourcepub fn iter(&self) -> Iter<'_, T>
pub fn iter(&self) -> Iter<'_, T>
Returns an iterator over borrowed syntax tree nodes of type &T
.
Sourcepub fn iter_mut(&mut self) -> IterMut<'_, T>
pub fn iter_mut(&mut self) -> IterMut<'_, T>
Returns an iterator over mutably borrowed syntax tree nodes of type
&mut T
.
Sourcepub fn pairs(&self) -> Pairs<'_, T, P>
pub fn pairs(&self) -> Pairs<'_, T, P>
Returns an iterator over the contents of this sequence as borrowed punctuated pairs.
Sourcepub fn pairs_mut(&mut self) -> PairsMut<'_, T, P>
pub fn pairs_mut(&mut self) -> PairsMut<'_, T, P>
Returns an iterator over the contents of this sequence as mutably borrowed punctuated pairs.
Sourcepub fn push_value(&mut self, value: T)
pub fn push_value(&mut self, value: T)
Appends a syntax tree node onto the end of this punctuated sequence. The sequence must already have a trailing punctuation, or be empty.
Use push
instead if the punctuated sequence may or may not already
have trailing punctuation.
§Panics
Panics if the sequence is nonempty and does not already have a trailing punctuation.
Sourcepub fn push_punct(&mut self, punctuation: P)
pub fn push_punct(&mut self, punctuation: P)
Appends a trailing punctuation onto the end of this punctuated sequence. The sequence must be non-empty and must not already have trailing punctuation.
§Panics
Panics if the sequence is empty or already has a trailing punctuation.
Sourcepub fn pop(&mut self) -> Option<Pair<T, P>>
pub fn pop(&mut self) -> Option<Pair<T, P>>
Removes the last punctuated pair from this sequence, or None
if the
sequence is empty.
Sourcepub fn pop_punct(&mut self) -> Option<P>
pub fn pop_punct(&mut self) -> Option<P>
Removes the trailing punctuation from this punctuated sequence, or
None
if there isn’t any.
Sourcepub fn trailing_punct(&self) -> bool
pub fn trailing_punct(&self) -> bool
Determines whether this punctuated sequence ends with a trailing punctuation.
Sourcepub fn empty_or_trailing(&self) -> bool
pub fn empty_or_trailing(&self) -> bool
Returns true if either this Punctuated
is empty, or it has a trailing
punctuation.
Equivalent to punctuated.is_empty() || punctuated.trailing_punct()
.
Sourcepub fn push(&mut self, value: T)where
P: Default,
pub fn push(&mut self, value: T)where
P: Default,
Appends a syntax tree node onto the end of this punctuated sequence.
If there is not a trailing punctuation in this sequence when this method
is called, the default value of punctuation type P
is inserted before
the given value of type T
.
Trait Implementations§
Source§impl FromIterator<SolIdent> for SolPath
impl FromIterator<SolIdent> for SolPath
Source§impl Spanned for SolPath
impl Spanned for SolPath
Source§fn span(&self) -> Span
fn span(&self) -> Span
Span
covering the complete contents of this syntax tree
node, or Span::call_site()
if this node is empty.