Struct syn_solidity::SolPath

source ·
pub struct SolPath(/* private fields */);
Expand description

A list of identifiers, separated by dots.

This is never parsed as empty.

Implementations§

source§

impl SolPath

source

pub const fn new() -> Self

source

pub fn first(&self) -> &SolIdent

source

pub fn first_mut(&mut self) -> &mut SolIdent

source

pub fn last(&self) -> &SolIdent

source

pub fn last_mut(&mut self) -> &mut SolIdent

Methods from Deref<Target = Punctuated<SolIdent, Dot>>§

source

pub fn is_empty(&self) -> bool

Determines whether this punctuated sequence is empty, meaning it contains no syntax tree nodes or punctuation.

source

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.

source

pub fn first(&self) -> Option<&T>

Borrows the first element in this sequence.

source

pub fn first_mut(&mut self) -> Option<&mut T>

Mutably borrows the first element in this sequence.

source

pub fn last(&self) -> Option<&T>

Borrows the last element in this sequence.

source

pub fn last_mut(&mut self) -> Option<&mut T>

Mutably borrows the last element in this sequence.

source

pub fn iter(&self) -> Iter<'_, T>

Returns an iterator over borrowed syntax tree nodes of type &T.

source

pub fn iter_mut(&mut self) -> IterMut<'_, T>

Returns an iterator over mutably borrowed syntax tree nodes of type &mut T.

source

pub fn pairs(&self) -> Pairs<'_, T, P>

Returns an iterator over the contents of this sequence as borrowed punctuated pairs.

source

pub fn pairs_mut(&mut self) -> PairsMut<'_, T, P>

Returns an iterator over the contents of this sequence as mutably borrowed punctuated pairs.

source

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.

source

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.

source

pub fn pop(&mut self) -> Option<Pair<T, P>>

Removes the last punctuated pair from this sequence, or None if the sequence is empty.

source

pub fn pop_punct(&mut self) -> Option<P>

Removes the trailing punctuation from this punctuated sequence, or None if there isn’t any.

source

pub fn trailing_punct(&self) -> bool

Determines whether this punctuated sequence ends with a trailing punctuation.

source

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().

source

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.

source

pub fn insert(&mut self, index: usize, value: T)
where P: Default,

Inserts an element at position index.

§Panics

Panics if index is greater than the number of elements previously in this punctuated sequence.

source

pub fn clear(&mut self)

Clears the sequence of all values and punctuation, making it empty.

Trait Implementations§

source§

impl Clone for SolPath

source§

fn clone(&self) -> SolPath

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for SolPath

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for SolPath

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Deref for SolPath

§

type Target = Punctuated<SolIdent, Dot>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl DerefMut for SolPath

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl Display for SolPath

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl FromIterator<SolIdent> for SolPath

source§

fn from_iter<T: IntoIterator<Item = SolIdent>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl Hash for SolPath

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Parse for SolPath

source§

fn parse(input: ParseStream<'_>) -> Result<Self>

source§

impl PartialEq for SolPath

source§

fn eq(&self, other: &SolPath) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Spanned for SolPath

source§

fn span(&self) -> Span

Returns a Span covering the complete contents of this syntax tree node, or Span::call_site() if this node is empty.
source§

fn set_span(&mut self, span: Span)

Sets the span of this syntax tree node if it is not empty.
source§

fn with_span(self, span: Span) -> Self
where Self: Sized,

Sets the span of this owned syntax tree node if it is not empty.
source§

impl Eq for SolPath

source§

impl StructuralPartialEq for SolPath

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.