Type Alias lazy_list::LazyListBoxed
source · pub type LazyListBoxed<'a, T> = LazyList<T, Box<dyn Iterator<Item = T> + Send + 'a>>;
Expand description
Type alias for a LazyList
with an unknown iterator type, which might
borrow data with lifetime 'a
.
This type can be constructed via LazyList::boxed
, or by manually boxing
the iterator.
In most cases, LazyListOwned
is the type you want.
Aliased Type§
struct LazyListBoxed<'a, T> { /* private fields */ }
Implementations§
source§impl<'a, T: Send + Sync + 'a> LazyListBoxed<'a, T>
impl<'a, T: Send + Sync + 'a> LazyListBoxed<'a, T>
sourcepub fn recursive<F: FnMut(&LazyListBoxed<'a, T>, usize) -> Option<T> + Send + 'a>(
f: F
) -> Arc<LazyListBoxed<'a, T>>
pub fn recursive<F: FnMut(&LazyListBoxed<'a, T>, usize) -> Option<T> + Send + 'a>( f: F ) -> Arc<LazyListBoxed<'a, T>>
Creates a recursively-defined LazyList
. The closure should take a
reference to the LazyList
itself and an index, then return the element
at that index, or None
if there are no more elements. The closure
should only attempt to access prior elements of the LazyList
, or a
deadlock will occur.