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>
impl<P> Parameters<P>
pub const fn new() -> Self
pub fn eip712_signature(&self, name: String) -> String
pub fn names( &self, ) -> impl ExactSizeIterator<Item = Option<&SolIdent>> + DoubleEndedIterator + Clone
pub fn types( &self, ) -> impl ExactSizeIterator<Item = &Type> + DoubleEndedIterator + Clone
pub fn types_mut( &mut self, ) -> impl ExactSizeIterator<Item = &mut Type> + DoubleEndedIterator
pub fn types_and_names( &self, ) -> impl ExactSizeIterator<Item = (&Type, Option<&SolIdent>)> + DoubleEndedIterator
pub fn type_strings( &self, ) -> impl ExactSizeIterator<Item = String> + DoubleEndedIterator + Clone + '_
pub fn visit_types(&self, f: impl FnMut(&Type))
visit
only.pub fn visit_types_mut(&mut self, f: impl FnMut(&mut Type))
visit-mut
only.Methods from Deref<Target = Punctuated<VariableDeclaration, P>>§
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<P: Clone> Clone for Parameters<P>
impl<P: Clone> Clone for Parameters<P>
Source§fn clone(&self) -> Parameters<P>
fn clone(&self) -> Parameters<P>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<P> Debug for Parameters<P>
impl<P> Debug for Parameters<P>
Source§impl<P: Default> Default for Parameters<P>
impl<P: Default> Default for Parameters<P>
Source§fn default() -> Parameters<P>
fn default() -> Parameters<P>
Source§impl<P> Deref for Parameters<P>
impl<P> Deref for Parameters<P>
Source§type Target = Punctuated<VariableDeclaration, P>
type Target = Punctuated<VariableDeclaration, P>
Source§impl<P> DerefMut for Parameters<P>
impl<P> DerefMut for Parameters<P>
Source§impl<P: Default> FromIterator<VariableDeclaration> for Parameters<P>
impl<P: Default> FromIterator<VariableDeclaration> for Parameters<P>
Source§fn from_iter<T: IntoIterator<Item = VariableDeclaration>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = VariableDeclaration>>(iter: T) -> Self
Source§impl<'a, P> IntoIterator for &'a Parameters<P>
impl<'a, P> IntoIterator for &'a Parameters<P>
Source§type IntoIter = Iter<'a, VariableDeclaration>
type IntoIter = Iter<'a, VariableDeclaration>
Source§type Item = <<&'a Parameters<P> as IntoIterator>::IntoIter as Iterator>::Item
type Item = <<&'a Parameters<P> as IntoIterator>::IntoIter as Iterator>::Item
Source§impl<'a, P> IntoIterator for &'a mut Parameters<P>
impl<'a, P> IntoIterator for &'a mut Parameters<P>
Source§type IntoIter = IterMut<'a, VariableDeclaration>
type IntoIter = IterMut<'a, VariableDeclaration>
Source§type Item = <<&'a mut Parameters<P> as IntoIterator>::IntoIter as Iterator>::Item
type Item = <<&'a mut Parameters<P> as IntoIterator>::IntoIter as Iterator>::Item
Source§impl<P> IntoIterator for Parameters<P>
impl<P> IntoIterator for Parameters<P>
Source§type IntoIter = <Punctuated<VariableDeclaration, P> as IntoIterator>::IntoIter
type IntoIter = <Punctuated<VariableDeclaration, P> as IntoIterator>::IntoIter
Source§type Item = <<Parameters<P> as IntoIterator>::IntoIter as Iterator>::Item
type Item = <<Parameters<P> as IntoIterator>::IntoIter as Iterator>::Item
Source§impl<P: PartialEq> PartialEq for Parameters<P>
impl<P: PartialEq> PartialEq for Parameters<P>
Source§impl<P: Spanned> Spanned for Parameters<P>
impl<P: Spanned> Spanned for Parameters<P>
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.