Enum devise::syn::punctuated::Pair
source · pub enum Pair<T, P> {
Punctuated(T, P),
End(T),
}
Expand description
A single syntax tree node of type T
followed by its trailing punctuation
of type P
if any.
Refer to the module documentation for details about punctuated sequences.
Variants§
Implementations§
source§impl<T, P> Pair<T, P>
impl<T, P> Pair<T, P>
sourcepub fn into_value(self) -> T
pub fn into_value(self) -> T
Extracts the syntax tree node from this punctuated pair, discarding the following punctuation.
sourcepub fn value_mut(&mut self) -> &mut T
pub fn value_mut(&mut self) -> &mut T
Mutably borrows the syntax tree node from this punctuated pair.
sourcepub fn punct(&self) -> Option<&P>
pub fn punct(&self) -> Option<&P>
Borrows the punctuation from this punctuated pair, unless this pair is the final one and there is no trailing punctuation.
sourcepub fn new(t: T, d: Option<P>) -> Pair<T, P>
pub fn new(t: T, d: Option<P>) -> Pair<T, P>
Creates a punctuated pair out of a syntax tree node and an optional following punctuation.
sourcepub fn into_tuple(self) -> (T, Option<P>)
pub fn into_tuple(self) -> (T, Option<P>)
Produces this punctuated pair as a tuple of syntax tree node and optional following punctuation.
Trait Implementations§
source§impl<T, P> Extend<Pair<T, P>> for Punctuated<T, P>
impl<T, P> Extend<Pair<T, P>> for Punctuated<T, P>
source§fn extend<I>(&mut self, i: I)where
I: IntoIterator<Item = Pair<T, P>>,
fn extend<I>(&mut self, i: I)where
I: IntoIterator<Item = Pair<T, P>>,
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
source§impl<T, P> FromIterator<Pair<T, P>> for Punctuated<T, P>
impl<T, P> FromIterator<Pair<T, P>> for Punctuated<T, P>
source§fn from_iter<I>(i: I) -> Punctuated<T, P>where
I: IntoIterator<Item = Pair<T, P>>,
fn from_iter<I>(i: I) -> Punctuated<T, P>where
I: IntoIterator<Item = Pair<T, P>>,
Creates a value from an iterator. Read more