pub struct Punctuated<T, P> {
inner: Vec<(T, P)>,
last: Option<Box<T>>,
}
Expand description
A punctuated sequence of values of type T
separated by punctuation of type P
Fields§
§inner: Vec<(T, P)>
§last: Option<Box<T>>
Implementations§
Source§impl<T, P> Punctuated<T, P>
impl<T, P> Punctuated<T, P>
pub fn len(&self) -> usize
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Determines whether this punctuated sequence is empty, meaning it contains no syntax tree nodes or punctuation.
Sourcepub fn push_value(&mut self, value: T)
pub fn push_value(&mut self, value: T)
Appends a syntax tree node onto the end of this punctuated sequence. The sequence must already have a trailing punctuation, or be empty.
§Panics
Panics if the sequence is nonempty and does not already have a trailing punctuation.
Sourcepub fn empty_or_trailing(&self) -> bool
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()
.
Sourcepub fn trailing_punct(&self) -> bool
pub fn trailing_punct(&self) -> bool
Determines whether this punctuated sequence ends with a trailing punctuation.
pub fn into_values(self) -> Vec<T>
Trait Implementations§
Auto Trait Implementations§
impl<T, P> Freeze for Punctuated<T, P>
impl<T, P> RefUnwindSafe for Punctuated<T, P>where
T: RefUnwindSafe,
P: RefUnwindSafe,
impl<T, P> Send for Punctuated<T, P>
impl<T, P> Sync for Punctuated<T, P>
impl<T, P> Unpin for Punctuated<T, P>
impl<T, P> UnwindSafe for Punctuated<T, P>where
T: UnwindSafe,
P: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more