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>
impl<'iter, 'source> TemplateListIter<'iter, 'source>
pub fn new( ident_span: Span, template_list: &'iter [Handle<Expression<'source>>], ) -> Self
pub fn finish( self, ctx: &ExpressionContext<'source, '_, '_>, ) -> Result<(), Box<Error<'source>>>
fn expect_next( &mut self, description: &'static str, ) -> Result<Handle<Expression<'source>>, Box<Error<'source>>>
pub fn ty( &mut self, lowerer: &mut Lowerer<'source, '_>, ctx: &mut ExpressionContext<'source, '_, '_>, ) -> Result<Handle<Type>, Box<Error<'source>>>
Sourcepub fn ty_with_span(
&mut self,
lowerer: &mut Lowerer<'source, '_>,
ctx: &mut ExpressionContext<'source, '_, '_>,
) -> Result<(Handle<Type>, Span), Box<Error<'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.
pub fn scalar_ty( &mut self, lowerer: &mut Lowerer<'source, '_>, ctx: &mut ExpressionContext<'source, '_, '_>, ) -> Result<(Scalar, Span), Box<Error<'source>>>
pub fn maybe_array_size( &mut self, lowerer: &mut Lowerer<'source, '_>, ctx: &mut ExpressionContext<'source, '_, '_>, ) -> Result<ArraySize, Box<Error<'source>>>
pub fn address_space( &mut self, ctx: &ExpressionContext<'source, '_, '_>, ) -> Result<AddressSpace, Box<Error<'source>>>
pub fn maybe_address_space( &mut self, ctx: &ExpressionContext<'source, '_, '_>, ) -> Result<Option<AddressSpace>, Box<Error<'source>>>
pub fn access_mode( &mut self, ctx: &ExpressionContext<'source, '_, '_>, ) -> Result<StorageAccess, Box<Error<'source>>>
Sourcepub fn maybe_access_mode(
&mut self,
space: &mut AddressSpace,
ctx: &ExpressionContext<'source, '_, '_>,
) -> Result<(), Box<Error<'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.