flux_syntax::surface

Struct Punctuated

Source
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>

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Determines whether this punctuated sequence is empty, meaning it contains no syntax tree nodes or punctuation.

Source

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.

Source

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().

Source

pub fn trailing_punct(&self) -> bool

Determines whether this punctuated sequence ends with a trailing punctuation.

Source

pub fn into_values(self) -> Vec<T>

Trait Implementations§

Source§

impl<T, P> From<Vec<(T, P)>> for Punctuated<T, P>

Source§

fn from(inner: Vec<(T, P)>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<T, P> Freeze for Punctuated<T, P>

§

impl<T, P> RefUnwindSafe for Punctuated<T, P>

§

impl<T, P> Send for Punctuated<T, P>
where T: Send, P: Send,

§

impl<T, P> Sync for Punctuated<T, P>
where T: Sync, P: Sync,

§

impl<T, P> Unpin for Punctuated<T, P>
where T: Unpin, P: Unpin,

§

impl<T, P> UnwindSafe for Punctuated<T, P>
where T: UnwindSafe, P: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.