Skip to main content

IntoObjectIterator

Trait IntoObjectIterator 

Source
pub trait IntoObjectIterator<T: 'static, S, C, R>: Iterate<T, S, C, R> { }
Expand description

A typed generalized-iterator step accepted by crate::ObjectType.

The factory receives the payload once and returns owned state for one loop. The step receives that private state and the previous control value. Returning None completes the loop. A returned tuple’s first value is both Luau’s next control value and the loop’s first visible value, exactly like a regular Luau iterator function. Rustia requires that first value to have exactly the same type as the incoming control.

ⓘ
use rustia::ObjectType;
struct Values;
let _ = ObjectType::<Values>::new("Values").iterator(1, |_| Ok::<_, rustia::Error>(()),
    |_: &mut (), _: Option<i64>| Some(("wrong control", 1_i64)));

An iterator step must return at least its next control value:

ⓘ
use rustia::ObjectType;
struct Values;
let _ = ObjectType::<Values>::new("Values").iterator(1, |_| Ok::<_, rustia::Error>(()),
    |_: &mut (), _: Option<i64>| Some(()));

Implementors§

Source§

impl<T: 'static, S, C, R, F: Iterate<T, S, C, R>> IntoObjectIterator<T, S, C, R> for F