Skip to main content

NormalizedRangeIterator

Trait NormalizedRangeIterator 

Source
pub unsafe trait NormalizedRangeIterator: Iterator<Item = Range> {
    // Provided methods
    fn filter_map_ranges<F>(self, f: F) -> FilterMapRanges<Self, F> ⓘ
       where Self: Sized,
             F: Fn(Type) -> Option<Type> { ... }
    fn filter_map_ram(self) -> impl NormalizedRangeIterator
       where Self: Sized { ... }
}
Expand description

An iterator over a normalized collection of ranges.

A normalized collection of ranges is one in which the ranges are:

  • Lexicographically sorted on endpoint
  • Mutually disjoint
  • Maximally contiguous (adjacent ranges never share the same type)

§Safety

Implementors must guarantee that the items in iteration order are indeed normalized

Provided Methods§

Source

fn filter_map_ranges<F>(self, f: F) -> FilterMapRanges<Self, F> ⓘ
where Self: Sized, F: Fn(Type) -> Option<Type>,

Creates a normalized range iterator which maps and filters out the range type.

f serves as the map that determines which types maps to which, and which are discarded or filtered out.

Source

fn filter_map_ram(self) -> impl NormalizedRangeIterator
where Self: Sized,

Creates a normalized range iterator which forgets about non-ram types, and sees allocated types as free ram.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<I> NormalizedRangeIterator for Peekable<I>

Safety:

Peekable yields the exact same items in the exact same order as the underlying iterator.

Implementors§

Source§

impl<I, F> NormalizedRangeIterator for FilterMapRanges<I, F>
where I: NormalizedRangeIterator, F: Fn(Type) -> Option<Type>,

Safety: Merging of neighboring ranges while tweaking types preserves normalization.

Source§

impl<I> NormalizedRangeIterator for NormalizedRangeCheckingIterator<I>
where I: Iterator<Item = Range>,