Enum Pair
pub enum Pair<T, P>
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
-
Punctuated(T, P) -
End(T)
Implementations
impl<T, P> Pair<&T, &P>
fn cloned(self) -> Pair<T, P> where T: Clone, P: Clone,
impl<T, P> Pair<T, P>
fn into_value(self) -> TExtracts the syntax tree node from this punctuated pair, discarding the following punctuation.
fn value(&self) -> &TBorrows the syntax tree node from this punctuated pair.
fn value_mut(&mut self) -> &mut TMutably borrows the syntax tree node from this punctuated pair.
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.
fn punct_mut(&mut self) -> Option<&mut P>Mutably borrows the punctuation from this punctuated pair, unless the pair is the final one and there is no trailing punctuation.
Example
# use Span; # use Punctuated; # use ; # # let mut punctuated = >new; # let span = call_site; # punctuated.insert; if let Some = punctuated.pairs_mut.next.unwrap.punct_mutfn new(t: T, p: Option<P>) -> SelfCreates a punctuated pair out of a syntax tree node and an optional following punctuation.
fn into_tuple(self) -> (T, Option<P>)Produces this punctuated pair as a tuple of syntax tree node and optional following punctuation.
Trait Implementations
impl<T, P> Clone for Pair<T, P>
where
T: Clone,
P: Clone,
fn clone(&self) -> Self
impl<T, P> Copy for Pair<T, P>
where
T: Copy,
P: Copy,
impl<T, P> ToTokens for Pair<T, P>
where
T: ToTokens,
P: ToTokens,
fn to_tokens(&self, tokens: &mut TokenStream)
Auto Trait Implementations
impl<T, P> Freeze for Pair<T, P>
where
T: Freeze + Freeze,
P: Freeze,
impl<T, P> RefUnwindSafe for Pair<T, P>
where
T: RefUnwindSafe + RefUnwindSafe,
P: RefUnwindSafe,
impl<T, P> Send for Pair<T, P>
where
T: Send + Send,
P: Send,
impl<T, P> Sync for Pair<T, P>
where
T: Sync + Sync,
P: Sync,
impl<T, P> Unpin for Pair<T, P>
where
T: Unpin + Unpin,
P: Unpin,
impl<T, P> UnsafeUnpin for Pair<T, P>
where
T: UnsafeUnpin + UnsafeUnpin,
P: UnsafeUnpin,
impl<T, P> UnwindSafe for Pair<T, P>
where
T: UnwindSafe + UnwindSafe,
P: UnwindSafe,
Blanket Implementations
impl<T> Any for Pair<T, P>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Pair<T, P>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Pair<T, P>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Pair<T, P>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Pair<T, P>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Spanned for Pair<T, P>
where
T: Spanned + ?Sized,
fn span(&self) -> Span
impl<T> ToOwned for Pair<T, P>
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for Pair<T, P>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Pair<T, P>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Pair<T, P>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>