TemplateListIter

Struct TemplateListIter 

Source
pub struct TemplateListIter<'iter, 'source> {
    ident_span: Span,
    template_list: Iter<'iter, Handle<Expression<'source>>>,
}
Expand description

Iterator over a template list.

All functions will attempt to consume an element in the list.

Function variants prefixed with “maybe” will not return an error if there are no more elements left in the list.

Fields§

§ident_span: Span§template_list: Iter<'iter, Handle<Expression<'source>>>

Implementations§

Source§

impl<'iter, 'source> TemplateListIter<'iter, 'source>

Source

pub fn new( ident_span: Span, template_list: &'iter [Handle<Expression<'source>>], ) -> Self

Source

pub fn finish( self, ctx: &ExpressionContext<'source, '_, '_>, ) -> Result<(), Box<Error<'source>>>

Source

fn expect_next( &mut self, description: &'static str, ) -> Result<Handle<Expression<'source>>, Box<Error<'source>>>

Source

pub fn ty( &mut self, lowerer: &mut Lowerer<'source, '_>, ctx: &mut ExpressionContext<'source, '_, '_>, ) -> Result<Handle<Type>, Box<Error<'source>>>

Source

pub fn ty_with_span( &mut self, lowerer: &mut Lowerer<'source, '_>, ctx: &mut ExpressionContext<'source, '_, '_>, ) -> Result<(Handle<Type>, Span), Box<Error<'source>>>

Lower the next template list element as a type, and return its span.

This returns the span of the template list element. This is generally different from the span of the returned Handle<ir::Type>, as the latter may refer to the type’s definition, not its use in the template list.

Source

pub fn scalar_ty( &mut self, lowerer: &mut Lowerer<'source, '_>, ctx: &mut ExpressionContext<'source, '_, '_>, ) -> Result<(Scalar, Span), Box<Error<'source>>>

Source

pub fn maybe_array_size( &mut self, lowerer: &mut Lowerer<'source, '_>, ctx: &mut ExpressionContext<'source, '_, '_>, ) -> Result<ArraySize, Box<Error<'source>>>

Source

pub fn address_space( &mut self, ctx: &ExpressionContext<'source, '_, '_>, ) -> Result<AddressSpace, Box<Error<'source>>>

Source

pub fn maybe_address_space( &mut self, ctx: &ExpressionContext<'source, '_, '_>, ) -> Result<Option<AddressSpace>, Box<Error<'source>>>

Source

pub fn access_mode( &mut self, ctx: &ExpressionContext<'source, '_, '_>, ) -> Result<StorageAccess, Box<Error<'source>>>

Source

pub fn maybe_access_mode( &mut self, space: &mut AddressSpace, ctx: &ExpressionContext<'source, '_, '_>, ) -> Result<(), Box<Error<'source>>>

Update space with an access mode from self, if appropriate.

If space is Storage, and there is another template parameter in self, parse it as a storage mode and mutate space accordingly. If there are no more template parameters, treat that like read.

If space is some other address space, don’t consume any template parameters.

Source

pub fn storage_format( &mut self, ctx: &ExpressionContext<'source, '_, '_>, ) -> Result<StorageFormat, Box<Error<'source>>>

Source

pub fn maybe_vertex_return( &mut self, ctx: &ExpressionContext<'source, '_, '_>, ) -> Result<bool, Box<Error<'source>>>

Source

pub fn cooperative_role( &mut self, ctx: &ExpressionContext<'source, '_, '_>, ) -> Result<CooperativeRole, Box<Error<'source>>>

Auto Trait Implementations§

§

impl<'iter, 'source> Freeze for TemplateListIter<'iter, 'source>

§

impl<'iter, 'source> RefUnwindSafe for TemplateListIter<'iter, 'source>

§

impl<'iter, 'source> Send for TemplateListIter<'iter, 'source>

§

impl<'iter, 'source> Sync for TemplateListIter<'iter, 'source>

§

impl<'iter, 'source> Unpin for TemplateListIter<'iter, 'source>

§

impl<'iter, 'source> UnwindSafe for TemplateListIter<'iter, 'source>

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.