[][src]Module syn::punctuated

A punctuated sequence of syntax tree nodes separated by punctuation.

Lots of things in Rust are punctuated sequences.

  • The fields of a struct are Punctuated<Field, Token![,]>.
  • The segments of a path are Punctuated<PathSegment, Token![::]>.
  • The bounds on a generic parameter are Punctuated<TypeParamBound, Token![+]>.
  • The arguments to a function call are Punctuated<Expr, Token![,]>.

This module provides a common representation for these punctuated sequences in the form of the Punctuated<T, P> type. We store a vector of pairs of syntax tree node + punctuation, where every node in the sequence is followed by punctuation except for possibly the final one.

a_function_call(arg1, arg2, arg3);
                ^^^^^ ~~~~~ ^^^^

Structs

IntoIter

An iterator over owned values of type T.

IntoPairs

An iterator over owned pairs of type Pair<T, P>.

Iter

An iterator over borrowed values of type &T.

IterMut

An iterator over mutably borrowed values of type &mut T.

Pairs

An iterator over borrowed pairs of type Pair<&T, &P>.

PairsMut

An iterator over mutably borrowed pairs of type Pair<&mut T, &mut P>.

Punctuated

A punctuated sequence of syntax tree nodes of type T separated by punctuation of type P.

Enums

Pair

A single syntax tree node of type T followed by its trailing punctuation of type P if any.