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.

Borrows the first element in this sequence.

Mutably borrows the first element in this sequence.

Borrows the last element in this sequence.

Mutably borrows the last 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.

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

Trait Implementations

Formats the value using the given formatter. Read more

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

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

Performs the conversion.

Creates a value from an iterator. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. 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

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.