[−][src]Struct syn::punctuated::Punctuated
pub struct Punctuated<T, P> { /* fields omitted */ }
A punctuated sequence of syntax tree nodes of type T
separated by
punctuation of type P
.
Refer to the module documentation for details about punctuated sequences.
Methods
impl<T, P> Punctuated<T, P>
[src]
impl<T, P> Punctuated<T, P>
pub fn new() -> Punctuated<T, P>
[src]
pub fn new() -> Punctuated<T, P>
Creates an empty punctuated sequence.
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Determines whether this punctuated sequence is empty, meaning it contains no syntax tree nodes or punctuation.
pub fn len(&self) -> usize
[src]
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
.
pub fn first(&self) -> Option<Pair<&T, &P>>
[src]
pub fn first(&self) -> Option<Pair<&T, &P>>
Borrows the first punctuated pair in this sequence.
pub fn last(&self) -> Option<Pair<&T, &P>>
[src]
pub fn last(&self) -> Option<Pair<&T, &P>>
Borrows the last punctuated pair in this sequence.
pub fn last_mut(&mut self) -> Option<Pair<&mut T, &mut P>>
[src]
pub fn last_mut(&mut self) -> Option<Pair<&mut T, &mut P>>
Mutably borrows the last punctuated pair in this sequence.
ⓘImportant traits for Iter<'a, T>pub fn iter(&self) -> Iter<T>
[src]
pub fn iter(&self) -> Iter<T>
Returns an iterator over borrowed syntax tree nodes of type &T
.
ⓘImportant traits for IterMut<'a, T>pub fn iter_mut(&mut self) -> IterMut<T>
[src]
pub fn iter_mut(&mut self) -> IterMut<T>
Returns an iterator over mutably borrowed syntax tree nodes of type
&mut T
.
ⓘImportant traits for Pairs<'a, T, P>pub fn pairs(&self) -> Pairs<T, P>
[src]
pub fn pairs(&self) -> Pairs<T, P>
Returns an iterator over the contents of this sequence as borrowed punctuated pairs.
ⓘImportant traits for PairsMut<'a, T, P>pub fn pairs_mut(&mut self) -> PairsMut<T, P>
[src]
pub fn pairs_mut(&mut self) -> PairsMut<T, P>
Returns an iterator over the contents of this sequence as mutably borrowed punctuated pairs.
ⓘImportant traits for IntoPairs<T, P>pub fn into_pairs(self) -> IntoPairs<T, P>
[src]
pub fn into_pairs(self) -> IntoPairs<T, P>
Returns an iterator over the contents of this sequence as owned punctuated pairs.
pub fn push_value(&mut self, value: T)
[src]
pub fn push_value(&mut self, value: T)
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.
pub fn push_punct(&mut self, punctuation: P)
[src]
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.
pub fn pop(&mut self) -> Option<Pair<T, P>>
[src]
pub fn pop(&mut self) -> Option<Pair<T, P>>
Removes the last punctuated pair from this sequence, or None
if the
sequence is empty.
pub fn trailing_punct(&self) -> bool
[src]
pub fn trailing_punct(&self) -> bool
Determines whether this punctuated sequence ends with a trailing punctuation.
pub fn empty_or_trailing(&self) -> bool
[src]
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()
.
impl<T, P> Punctuated<T, P> where
P: Default,
[src]
impl<T, P> Punctuated<T, P> where
P: Default,
pub fn push(&mut self, value: T)
[src]
pub fn push(&mut self, value: T)
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
.
pub fn insert(&mut self, index: usize, value: T)
[src]
pub fn insert(&mut self, index: usize, value: T)
Inserts an element at position index
.
Panics
Panics if index
is greater than the number of elements previously in
this punctuated sequence.
impl<T, P> Punctuated<T, P> where
T: Synom,
P: Synom,
[src]
impl<T, P> Punctuated<T, P> where
T: Synom,
P: Synom,
pub fn parse_separated(input: Cursor) -> PResult<Self>
[src]
pub fn parse_separated(input: Cursor) -> PResult<Self>
Parse zero or more syntax tree nodes with punctuation in between and no trailing punctuation.
pub fn parse_separated_nonempty(input: Cursor) -> PResult<Self>
[src]
pub fn parse_separated_nonempty(input: Cursor) -> PResult<Self>
Parse one or more syntax tree nodes with punctuation in bewteen and no trailing punctuation. allowing trailing punctuation.
pub fn parse_terminated(input: Cursor) -> PResult<Self>
[src]
pub fn parse_terminated(input: Cursor) -> PResult<Self>
Parse zero or more syntax tree nodes with punctuation in between and optional trailing punctuation.
pub fn parse_terminated_nonempty(input: Cursor) -> PResult<Self>
[src]
pub fn parse_terminated_nonempty(input: Cursor) -> PResult<Self>
Parse one or more syntax tree nodes with punctuation in between and optional trailing punctuation.
impl<T, P> Punctuated<T, P> where
P: Synom,
[src]
impl<T, P> Punctuated<T, P> where
P: Synom,
pub fn parse_separated_with(
input: Cursor,
parse: fn(_: Cursor) -> PResult<T>
) -> PResult<Self>
[src]
pub fn parse_separated_with(
input: Cursor,
parse: fn(_: Cursor) -> PResult<T>
) -> PResult<Self>
Parse zero or more syntax tree nodes using the given parser with punctuation in between and no trailing punctuation.
pub fn parse_separated_nonempty_with(
input: Cursor,
parse: fn(_: Cursor) -> PResult<T>
) -> PResult<Self>
[src]
pub fn parse_separated_nonempty_with(
input: Cursor,
parse: fn(_: Cursor) -> PResult<T>
) -> PResult<Self>
Parse one or more syntax tree nodes using the given parser with punctuation in between and no trailing punctuation.
pub fn parse_terminated_with(
input: Cursor,
parse: fn(_: Cursor) -> PResult<T>
) -> PResult<Self>
[src]
pub fn parse_terminated_with(
input: Cursor,
parse: fn(_: Cursor) -> PResult<T>
) -> PResult<Self>
Parse zero or more syntax tree nodes using the given parser with punctuation in between and optional trailing punctuation.
pub fn parse_terminated_nonempty_with(
input: Cursor,
parse: fn(_: Cursor) -> PResult<T>
) -> PResult<Self>
[src]
pub fn parse_terminated_nonempty_with(
input: Cursor,
parse: fn(_: Cursor) -> PResult<T>
) -> PResult<Self>
Parse one or more syntax tree nodes using the given parser with punctuation in between and optional trailing punctuation.
Trait Implementations
impl<T, P> ToTokens for Punctuated<T, P> where
T: ToTokens,
P: ToTokens,
[src]
impl<T, P> ToTokens for Punctuated<T, P> where
T: ToTokens,
P: ToTokens,
fn to_tokens(&self, tokens: &mut TokenStream)
[src]
fn to_tokens(&self, tokens: &mut TokenStream)
Write self
to the given TokenStream
. Read more
fn into_token_stream(self) -> TokenStream
[src]
fn into_token_stream(self) -> TokenStream
Convert self
directly into a TokenStream
object. Read more
impl<T: Eq, P: Eq> Eq for Punctuated<T, P>
[src]
impl<T: Eq, P: Eq> Eq for Punctuated<T, P>
impl<T: PartialEq, P: PartialEq> PartialEq for Punctuated<T, P>
[src]
impl<T: PartialEq, P: PartialEq> PartialEq for Punctuated<T, P>
fn eq(&self, other: &Punctuated<T, P>) -> bool
[src]
fn eq(&self, other: &Punctuated<T, P>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Punctuated<T, P>) -> bool
[src]
fn ne(&self, other: &Punctuated<T, P>) -> bool
This method tests for !=
.
impl<T: Hash, P: Hash> Hash for Punctuated<T, P>
[src]
impl<T: Hash, P: Hash> Hash for Punctuated<T, P>
fn hash<__HTP: Hasher>(&self, state: &mut __HTP)
[src]
fn hash<__HTP: Hasher>(&self, state: &mut __HTP)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T: Clone, P: Clone> Clone for Punctuated<T, P>
[src]
impl<T: Clone, P: Clone> Clone for Punctuated<T, P>
fn clone(&self) -> Punctuated<T, P>
[src]
fn clone(&self) -> Punctuated<T, P>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<T: Debug, P: Debug> Debug for Punctuated<T, P>
[src]
impl<T: Debug, P: Debug> Debug for Punctuated<T, P>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T, P> FromIterator<T> for Punctuated<T, P> where
P: Default,
[src]
impl<T, P> FromIterator<T> for Punctuated<T, P> where
P: Default,
fn from_iter<I: IntoIterator<Item = T>>(i: I) -> Self
[src]
fn from_iter<I: IntoIterator<Item = T>>(i: I) -> Self
Creates a value from an iterator. Read more
impl<T, P> Extend<T> for Punctuated<T, P> where
P: Default,
[src]
impl<T, P> Extend<T> for Punctuated<T, P> where
P: Default,
fn extend<I: IntoIterator<Item = T>>(&mut self, i: I)
[src]
fn extend<I: IntoIterator<Item = T>>(&mut self, i: I)
Extends a collection with the contents of an iterator. Read more
impl<T, P> FromIterator<Pair<T, P>> for Punctuated<T, P>
[src]
impl<T, P> FromIterator<Pair<T, P>> for Punctuated<T, P>
fn from_iter<I: IntoIterator<Item = Pair<T, P>>>(i: I) -> Self
[src]
fn from_iter<I: IntoIterator<Item = Pair<T, P>>>(i: I) -> Self
Creates a value from an iterator. Read more
impl<T, P> Extend<Pair<T, P>> for Punctuated<T, P>
[src]
impl<T, P> Extend<Pair<T, P>> for Punctuated<T, P>
fn extend<I: IntoIterator<Item = Pair<T, P>>>(&mut self, i: I)
[src]
fn extend<I: IntoIterator<Item = Pair<T, P>>>(&mut self, i: I)
Extends a collection with the contents of an iterator. Read more
impl<T, P> IntoIterator for Punctuated<T, P>
[src]
impl<T, P> IntoIterator for Punctuated<T, P>
type Item = T
The type of the elements being iterated over.
type IntoIter = IntoIter<T, P>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
fn into_iter(self) -> Self::IntoIter
Creates an iterator from a value. Read more
impl<'a, T, P> IntoIterator for &'a Punctuated<T, P>
[src]
impl<'a, T, P> IntoIterator for &'a Punctuated<T, P>
type Item = &'a T
The type of the elements being iterated over.
type IntoIter = Iter<'a, T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
fn into_iter(self) -> Self::IntoIter
Creates an iterator from a value. Read more
impl<'a, T, P> IntoIterator for &'a mut Punctuated<T, P>
[src]
impl<'a, T, P> IntoIterator for &'a mut Punctuated<T, P>
type Item = &'a mut T
The type of the elements being iterated over.
type IntoIter = IterMut<'a, T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
fn into_iter(self) -> Self::IntoIter
Creates an iterator from a value. Read more
impl<T, P> Default for Punctuated<T, P>
[src]
impl<T, P> Default for Punctuated<T, P>
impl<T, P> Index<usize> for Punctuated<T, P>
[src]
impl<T, P> Index<usize> for Punctuated<T, P>
type Output = T
The returned type after indexing.
fn index(&self, index: usize) -> &Self::Output
[src]
fn index(&self, index: usize) -> &Self::Output
Performs the indexing (container[index]
) operation.
impl<T, P> IndexMut<usize> for Punctuated<T, P>
[src]
impl<T, P> IndexMut<usize> for Punctuated<T, P>
Auto Trait Implementations
impl<T, P> Send for Punctuated<T, P> where
P: Send,
T: Send,
impl<T, P> Send for Punctuated<T, P> where
P: Send,
T: Send,
impl<T, P> Sync for Punctuated<T, P> where
P: Sync,
T: Sync,
impl<T, P> Sync for Punctuated<T, P> where
P: Sync,
T: Sync,
Blanket Implementations
impl<T> Spanned for T where
T: ToTokens,
[src]
impl<T> Spanned for T where
T: ToTokens,
fn span(&Self) -> Span
[src]
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. Read more
impl<T> From for T
[src]
impl<T> From for T
impl<I> IntoIterator for I where
I: Iterator,
[src]
impl<I> IntoIterator for I where
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I
[src]
fn into_iter(self) -> I
Creates an iterator from a value. Read more
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
type Owned = T
fn to_owned(&self) -> T
[src]
fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
fn clone_into(&self, target: &mut T)
[src]
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
ⓘImportant traits for &'a mut Wfn borrow(&self) -> &T
[src]
fn borrow(&self) -> &T
Immutably borrows from an owned value. Read more
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
ⓘImportant traits for &'a mut Wfn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more
impl<E> SpecializationError for E
[src]
impl<E> SpecializationError for E
fn not_found<S, T>(trait_name: &'static str, method_name: &'static str) -> E where
T: ?Sized,
[src]
fn not_found<S, T>(trait_name: &'static str, method_name: &'static str) -> E where
T: ?Sized,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Create an error for a missing method specialization. Defaults to panicking with type, trait & method names. S
is the encoder/decoder state type, T
is the type being encoded/decoded, and the arguments are the names of the trait and method that should've been overridden. Read more
impl<T> Erased for T
[src]
impl<T> Erased for T
impl<T> Send for T where
T: ?Sized,
[src]
impl<T> Send for T where
T: ?Sized,
impl<T> Sync for T where
T: ?Sized,
[src]
impl<T> Sync for T where
T: ?Sized,
impl<T> Erased for T
impl<T> Erased for T