syn_solidity

Struct Parameters

Source
pub struct Parameters<P>(/* private fields */);
Expand description

A list of VariableDeclarations, separated by P.

Currently, P can only be Token![,] or Token![;].

It is recommended to use the type aliases where possible instead.

Implementations§

Source§

impl<P> Parameters<P>

Source

pub const fn new() -> Self

Source

pub fn eip712_signature(&self, name: String) -> String

Source

pub fn names( &self, ) -> impl ExactSizeIterator<Item = Option<&SolIdent>> + DoubleEndedIterator + Clone

Source

pub fn types( &self, ) -> impl ExactSizeIterator<Item = &Type> + DoubleEndedIterator + Clone

Source

pub fn types_mut( &mut self, ) -> impl ExactSizeIterator<Item = &mut Type> + DoubleEndedIterator

Source

pub fn types_and_names( &self, ) -> impl ExactSizeIterator<Item = (&Type, Option<&SolIdent>)> + DoubleEndedIterator

Source

pub fn type_strings( &self, ) -> impl ExactSizeIterator<Item = String> + DoubleEndedIterator + Clone + '_

Source

pub fn visit_types(&self, f: impl FnMut(&Type))

Available on crate feature visit only.
Source

pub fn visit_types_mut(&mut self, f: impl FnMut(&mut Type))

Available on crate feature visit-mut only.

Methods from Deref<Target = Punctuated<VariableDeclaration, P>>§

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 get(&self, index: usize) -> Option<&T>

Borrows the element at the given index.

Source

pub fn get_mut(&mut self, index: usize) -> Option<&mut T>

Mutably borrows the element at the given index.

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<P: Clone> Clone for Parameters<P>

Source§

fn clone(&self) -> Parameters<P>

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<P> Debug for Parameters<P>

Source§

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

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

impl<P: Default> Default for Parameters<P>

Source§

fn default() -> Parameters<P>

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

impl<P> Deref for Parameters<P>

Source§

type Target = Punctuated<VariableDeclaration, P>

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

impl<P> DerefMut for Parameters<P>

Source§

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

Mutably dereferences the value.
Source§

impl<P: Default> FromIterator<VariableDeclaration> for Parameters<P>

Source§

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

Creates a value from an iterator. Read more
Source§

impl<'a, P> IntoIterator for &'a Parameters<P>

Source§

type IntoIter = Iter<'a, VariableDeclaration>

Which kind of iterator are we turning this into?
Source§

type Item = <<&'a Parameters<P> as IntoIterator>::IntoIter as Iterator>::Item

The type of the elements being iterated over.
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, P> IntoIterator for &'a mut Parameters<P>

Source§

type IntoIter = IterMut<'a, VariableDeclaration>

Which kind of iterator are we turning this into?
Source§

type Item = <<&'a mut Parameters<P> as IntoIterator>::IntoIter as Iterator>::Item

The type of the elements being iterated over.
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<P> IntoIterator for Parameters<P>

Source§

type IntoIter = <Punctuated<VariableDeclaration, P> as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
Source§

type Item = <<Parameters<P> as IntoIterator>::IntoIter as Iterator>::Item

The type of the elements being iterated over.
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<P: PartialEq> PartialEq for Parameters<P>

Source§

fn eq(&self, other: &Parameters<P>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<P: Spanned> Spanned for Parameters<P>

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<P: Eq> Eq for Parameters<P>

Source§

impl<P> StructuralPartialEq for Parameters<P>

Auto Trait Implementations§

§

impl<P> Freeze for Parameters<P>

§

impl<P> RefUnwindSafe for Parameters<P>
where P: RefUnwindSafe,

§

impl<P> !Send for Parameters<P>

§

impl<P> !Sync for Parameters<P>

§

impl<P> Unpin for Parameters<P>
where P: Unpin,

§

impl<P> UnwindSafe for Parameters<P>
where P: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
Available on non-bootstrap only.
The target type on which the method may be called.
Source§

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

Source§

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>,

Source§

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>,

Source§

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.