Struct proc_macro_kwargs::parse::NestedList [−][src]
pub struct NestedList<T: MacroArg, P = Comma> { pub brackets: Bracket, pub elements: Punctuated<T, P>, }
Expand description
A nested list of Punctuated items,
surrounded by brackets (ex. [1, 2, 3]
)
By default, the separator token is the comma ,
Fields
brackets: Bracket
The brackets tokens
elements: Punctuated<T, P>
The list of elements, including punctuation
Methods from Deref<Target = Punctuated<T, P>>
Determines whether this punctuated sequence is empty, meaning it contains no syntax tree nodes or punctuation.
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
.
Mutably borrows the first element in this sequence.
Returns an iterator over borrowed syntax tree nodes of type &T
.
Returns an iterator over mutably borrowed syntax tree nodes of type
&mut T
.
Returns an iterator over the contents of this sequence as borrowed punctuated pairs.
Returns an iterator over the contents of this sequence as mutably borrowed punctuated pairs.
Appends a syntax tree node onto the end of this punctuated sequence. The sequence must previously have a trailing punctuation.
Use push
instead if the punctuated sequence may or may not already
have trailing punctuation.
Panics
Panics if the sequence does not already have a trailing punctuation when this method is called.
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.
Removes the last punctuated pair from this sequence, or None
if the
sequence is empty.
Determines whether this punctuated sequence ends with a trailing punctuation.
Returns true if either this Punctuated
is empty, or it has a trailing
punctuation.
Equivalent to punctuated.is_empty() || punctuated.trailing_punct()
.
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
.
Inserts an element at position index
.
Panics
Panics if index
is greater than the number of elements previously in
this punctuated sequence.
Trait Implementations
type Target = Punctuated<T, P>
type Target = Punctuated<T, P>
The resulting type after dereferencing.
Creates a value from an iterator. Read more
Parse the argument to the macro
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl<T, P> RefUnwindSafe for NestedList<T, P> where
P: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, P = Comma> !Send for NestedList<T, P>
impl<T, P = Comma> !Sync for NestedList<T, P>
impl<T, P> Unpin for NestedList<T, P> where
P: Unpin,
T: Unpin,
impl<T, P> UnwindSafe for NestedList<T, P> where
P: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.