Struct muse_lang::compiler::syntax::Delimited

source ·
pub struct Delimited<T, Delimiter = Ranged<Token>> {
    pub first: Option<T>,
    pub remaining: Vec<(Delimiter, T)>,
}
Expand description

A sequence of T, delimited by Delimiter.

Fields§

§first: Option<T>

The first entry in this sequence.

§remaining: Vec<(Delimiter, T)>

The remaining delimiter and entries.

Implementations§

source§

impl<T, Delimiter> Delimited<T, Delimiter>

source

pub const fn single(value: T) -> Self

Returns a list from a single value.

source

pub const fn empty() -> Self

Returns an empty list.

source

pub const fn build(first: T) -> DelimitedBuilder<T, Delimiter>

Returns a builder with the first element provided.

source

pub const fn build_empty() -> DelimitedBuilder<T, Delimiter>

Returns an empty builder.

source

pub fn len(&self) -> usize

Returns the number of elements contained in this collection.

source

pub const fn is_empty(&self) -> bool

Returns true if this collection is empty.

source

pub fn iter(&self) -> DelimitedIter<'_, T, Delimiter>

Returns an iterator over the values in this list.

source

pub fn iter_mut(&mut self) -> DelimitedIterMut<'_, T, Delimiter>

Returns an iterator over exclusive references to values in this list.

source

pub fn last(&self) -> Option<&T>

Returns the last value in this list.

Trait Implementations§

source§

impl<T: Clone, Delimiter: Clone> Clone for Delimited<T, Delimiter>

source§

fn clone(&self) -> Delimited<T, Delimiter>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug, Delimiter: Debug> Debug for Delimited<T, Delimiter>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T> Default for Delimited<T>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<T> Index<usize> for Delimited<T>

§

type Output = T

The returned type after indexing.
source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<'a, T, Delimiter> IntoIterator for &'a Delimited<T, Delimiter>

§

type IntoIter = DelimitedIter<'a, T, Delimiter>

Which kind of iterator are we turning this into?
§

type Item = &'a T

The type of the elements being iterated over.
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<'a, T, Delimiter> IntoIterator for &'a mut Delimited<T, Delimiter>

§

type IntoIter = DelimitedIterMut<'a, T, Delimiter>

Which kind of iterator are we turning this into?
§

type Item = &'a mut T

The type of the elements being iterated over.
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<T: PartialEq, Delimiter: PartialEq> PartialEq for Delimited<T, Delimiter>

source§

fn eq(&self, other: &Delimited<T, Delimiter>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> TokenizeInto for Delimited<T>
where T: TokenizeInto,

source§

fn tokenize_into(&self, tokens: &mut VecDeque<Ranged<Token>>)

Tokenize self into tokens.
source§

fn to_tokens(&self) -> VecDeque<Ranged<Token>>

Returns a list of tokens that could be re-parsed to produce this value.
source§

impl<T, Delimiter> StructuralPartialEq for Delimited<T, Delimiter>

Auto Trait Implementations§

§

impl<T, Delimiter> Freeze for Delimited<T, Delimiter>
where T: Freeze,

§

impl<T, Delimiter> RefUnwindSafe for Delimited<T, Delimiter>
where T: RefUnwindSafe, Delimiter: RefUnwindSafe,

§

impl<T, Delimiter> Send for Delimited<T, Delimiter>
where T: Send, Delimiter: Send,

§

impl<T, Delimiter> Sync for Delimited<T, Delimiter>
where T: Sync, Delimiter: Sync,

§

impl<T, Delimiter> Unpin for Delimited<T, Delimiter>
where T: Unpin, Delimiter: Unpin,

§

impl<T, Delimiter> UnwindSafe for Delimited<T, Delimiter>
where T: UnwindSafe, Delimiter: 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
§

impl<A> Cast for A

§

fn cast<To>(self) -> To
where To: CastFrom<A>,

Casts self to the To type. This may be a lossy operation.
§

impl<A> CastFrom<A> for A

§

fn from_cast(from: A) -> A

Returns from as Self.
§

impl<A, B> CastInto<A> for B
where A: CastFrom<B>,

§

fn cast_into(self) -> A

Returns self as To.
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> TokenizeRanged for T
where T: TokenizeInto,

source§

fn tokenize_ranged( &self, _range: SourceRange, tokens: &mut VecDeque<Ranged<Token>>, )

Tokenize self into tokens within the enclosing range.
source§

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

§

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

§

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more