Trait IteratorExt

Source
pub trait IteratorExt: Iterator {
    // Provided methods
    fn collect_to_blink<A: BlinkAllocator>(
        self,
        blink: &mut Blink<A>,
    ) -> &mut [Self::Item]
       where Self: Sized,
             Self::Item: 'static { ... }
    fn collect_to_blink_shared<A: BlinkAllocator>(
        self,
        blink: &mut Blink<A>,
    ) -> &[Self::Item]
       where Self: Sized { ... }
    fn collect_to_blink_no_drop<A: BlinkAllocator>(
        self,
        blink: &mut Blink<A>,
    ) -> &mut [Self::Item]
       where Self: Sized { ... }
    fn try_collect_to_blink<A: BlinkAllocator>(
        self,
        blink: &mut Blink<A>,
    ) -> Result<&mut [Self::Item], (&mut [Self::Item], Option<Self::Item>)>
       where Self: Sized,
             Self::Item: 'static { ... }
    fn try_collect_to_blink_shared<A: BlinkAllocator>(
        self,
        blink: &mut Blink<A>,
    ) -> Result<&[Self::Item], (&[Self::Item], Option<Self::Item>)>
       where Self: Sized { ... }
    fn try_collect_to_blink_no_drop<A: BlinkAllocator>(
        self,
        blink: &mut Blink<A>,
    ) -> Result<&mut [Self::Item], (&mut [Self::Item], Option<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.

Collect iterator into blink allocator and return slice reference.

Collect iterator into blink allocator and return slice reference.

Attempts to collect iterator into blink allocator and return slice reference.

Attempts to collect iterator into blink allocator and return slice reference.

Attempts to collect iterator into blink allocator and return slice reference.

Implementors§

Source§

impl<I> IteratorExt for I
where I: Iterator,