pub struct Punctuated<T: Parse, P: Parse> {
pub first: Box<T>,
pub collection: Vec<(P, T)>,
}
Expand description
A utility struct for collections of parsed items with punctuators between them.
Fields§
§first: Box<T>
The first parsed item.
collection: Vec<(P, T)>
The next items with punctuators.
Implementations§
Source§impl<T: Parse, P: Parse> Punctuated<T, P>
impl<T: Parse, P: Parse> Punctuated<T, P>
Sourcepub fn new(first: T) -> Punctuated<T, P>
pub fn new(first: T) -> Punctuated<T, P>
Creates a new instance of Punctuated
.
Sourcepub fn iter(&self) -> impl Iterator<Item = &T>
pub fn iter(&self) -> impl Iterator<Item = &T>
Turns the punctuated into an iterator on the items.
Sourcepub fn into_parsed_iter(self) -> impl Iterator<Item = T>
pub fn into_parsed_iter(self) -> impl Iterator<Item = T>
Turns the punctuated into an iterator on the items.
Trait Implementations§
Source§impl<T: Clone + Parse, P: Clone + Parse> Clone for Punctuated<T, P>
impl<T: Clone + Parse, P: Clone + Parse> Clone for Punctuated<T, P>
Source§fn clone(&self) -> Punctuated<T, P>
fn clone(&self) -> Punctuated<T, P>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T: Parse, P: Parse> Parse for Punctuated<T, P>
impl<T: Parse, P: Parse> Parse for Punctuated<T, P>
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
Source§impl<T> CheckParses for Twhere
T: Parse,
impl<T> CheckParses for Twhere
T: Parse,
Source§fn check_parses<'t, I>(input: &InputStream<'t, I>) -> Option<bool>
fn check_parses<'t, I>(input: &InputStream<'t, I>) -> Option<bool>
Check if
Self
would parse given the tokens.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CloneWithNode for Twhere
T: Clone,
impl<T> CloneWithNode for Twhere
T: Clone,
Source§fn clone_with_node(&mut self) -> T
fn clone_with_node(&mut self) -> T
Clone
self
and take its node.Source§fn clone_without_node(&self) -> T
fn clone_without_node(&self) -> T
Clone
self
without taking its node.Source§impl<T> Convert for T
impl<T> Convert for T
Source§fn convert<U>(self, context: &CompileContext) -> Expr<U>where
U: ConvertFrom<T>,
fn convert<U>(self, context: &CompileContext) -> Expr<U>where
U: ConvertFrom<T>,
Convert
self
into a specific type. Read moreSource§fn can_convert<U>(&self) -> boolwhere
U: ConvertFrom<T>,
fn can_convert<U>(&self) -> boolwhere
U: ConvertFrom<T>,
Check if
self
can be converted into a specific type. Read more