pub trait IteratorExt: Iterator {
    // Provided methods
    fn collect_to_blink(self, blink: &mut Blink) -> &mut [Self::Item]
       where Self: Sized,
             Self::Item: 'static { ... }
    fn collect_to_blink_shared(self, blink: &mut Blink) -> &[Self::Item]
       where Self: Sized { ... }
    fn collect_to_blink_no_drop(self, blink: &mut Blink) -> &mut [Self::Item]
       where Self: Sized { ... }
}
Expand description

Iterator extension trait for collecting iterators into blink allocator.

Examples

let mut blink = Blink::new();
let slice = (0..10).filter(|x| x % 3 != 0).collect_to_blink(&mut blink);
assert_eq!(slice, [1, 2, 4, 5, 7, 8]);
slice[0] = 10;
assert_eq!(slice, [10, 2, 4, 5, 7, 8]);

For non-static data with drop.

let mut blink = Blink::new();
let slice = (0..10).filter(|x| x % 3 != 0).collect_to_blink_shared(&mut blink);
assert_eq!(slice, [1, 2, 4, 5, 7, 8]);

For non-static data and no drop.

let mut blink = Blink::new();
let slice = (0..10).filter(|x| x % 3 != 0).collect_to_blink_no_drop(&mut blink);
assert_eq!(slice, [1, 2, 4, 5, 7, 8]);
slice[0] = 10;
assert_eq!(slice, [10, 2, 4, 5, 7, 8]);

Provided Methods§

Collect iterator into blink allocator and return slice reference.

Implementors§

source§

impl<I> IteratorExt for Iwhere I: Iterator,