Skip to main content

Iterable

Trait Iterable 

Source
pub trait Iterable<T: RudaType>: Sized {
    // Required methods
    fn expand(
        self,
        scope: &mut Scope,
        body: impl FnMut(&mut Scope, <T as RudaType>::ExpandType),
    );
    fn expand_unroll(
        self,
        scope: &mut Scope,
        body: impl FnMut(&mut Scope, <T as RudaType>::ExpandType),
    );

    // Provided method
    fn const_len(&self) -> Option<usize> { ... }
}
Expand description

Something that can be iterated on by a for loop. Currently only includes Range, StepBy and Sequence.

Required Methods§

Source

fn expand( self, scope: &mut Scope, body: impl FnMut(&mut Scope, <T as RudaType>::ExpandType), )

Expand a runtime loop without unrolling

§Arguments
§Arguments
  • scope - the expansion scope
  • body - the loop body to be executed repeatedly
Source

fn expand_unroll( self, scope: &mut Scope, body: impl FnMut(&mut Scope, <T as RudaType>::ExpandType), )

Expand an unrolled loop. The body should be invoced n times, where n is the number of iterations.

§Arguments
  • scope - the expansion scope
  • body - the loop body to be executed repeatedly

Provided Methods§

Source

fn const_len(&self) -> Option<usize>

Return the comptime length of this iterable, if possible

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§