Skip to main content

IntCOStack

Struct IntCOStack 

Source
pub struct IntCOStack<I>
where I: IntCO,
{ /* private fields */ }

Implementations§

Source§

impl<I> IntCOStack<I>
where I: IntCO,

Source

pub fn change_points(&self) -> &[ChangePoint<I::CoordType>]

Source

pub fn covered(&self) -> &IntCOSet<I>

Source

pub fn height_stats(&self) -> HeightStats

Source

pub fn height_at(&self, x: I::CoordType) -> usize

Source§

impl<I> IntCOStack<I>
where I: IntCO,

Source

pub fn iter_height_segments( &self, ) -> impl Iterator<Item = HeightSegment<I>> + '_

Iterates over positive-height stack segments.

Each item is a closed-open interval together with the stack height that applies throughout that interval.

If all positive-height regions have the same height, the segment intervals are exactly the covered set intervals and the shared height is supplied from height_stats. Otherwise, the height-preserving segmentation is reconstructed from change points.

Source

pub fn iter_height_segments_at_least( &self, min_height: usize, ) -> impl Iterator<Item = HeightSegment<I>> + '_

Iterates over positive-height stack segments whose height is at least min_height.

Each item is a closed-open interval together with the stack height that applies throughout that interval.

This method uses height_stats for cheap fast paths:

  • if min_height is greater than the observed maximum height, the iterator is empty;
  • if min_height is less than or equal to the observed minimum positive height, every positive-height segment matches and iter_height_segments is reused;
  • otherwise, canonical change points are scanned and filtered.

A min_height of zero is treated the same as requesting all positive-height segments, because zero-height gaps are never yielded.

Source

pub fn iter_height_segments_at_most( &self, max_height: usize, ) -> impl Iterator<Item = HeightSegment<I>> + '_

Iterates over positive-height stack segments whose height is at most max_height.

Each item is a closed-open interval together with the stack height that applies throughout that interval.

This method uses height_stats for cheap fast paths:

  • if max_height is zero, the iterator is empty because zero-height gaps are never yielded;
  • if max_height is smaller than the observed minimum positive height, the iterator is empty;
  • if max_height is greater than or equal to the observed maximum height, every positive-height segment matches and iter_height_segments is reused;
  • otherwise, canonical change points are scanned and filtered.
Source

pub fn iter_height_segments_exactly( &self, target_height: usize, ) -> impl Iterator<Item = HeightSegment<I>> + '_

Iterates over positive-height stack segments whose height is exactly target_height.

Each item is a closed-open interval together with the stack height that applies throughout that interval.

This method uses height_stats for cheap fast paths:

  • if target_height is zero, the iterator is empty because zero-height gaps are never yielded;
  • if target_height is outside the observed positive-height range, the iterator is empty;
  • if all positive-height regions share the same height and target_height equals that height, the intervals are exactly the covered set intervals;
  • otherwise, canonical change points are scanned and filtered.
Source

pub fn iter_height_segments_between( &self, min_height: usize, max_height: usize, ) -> impl Iterator<Item = HeightSegment<I>> + '_

Iterates over positive-height stack segments whose height is within min_height..=max_height.

Each item is a closed-open interval together with the stack height that applies throughout that interval.

Zero-height gaps are never yielded. Therefore, a min_height of zero is treated as if it included all positive heights.

This method uses height_stats for cheap fast paths:

  • if min_height > max_height, the iterator is empty;
  • if the stack has no positive-height segments, the iterator is empty;
  • if the requested range does not overlap the observed positive-height range, the iterator is empty;
  • if the requested range covers the full observed positive-height range, every segment matches and iter_height_segments is reused;
  • otherwise, canonical change points are scanned and filtered.
Source

pub fn iter_peak_height_segments( &self, ) -> impl Iterator<Item = HeightSegment<I>> + '_

Iterates over positive-height stack segments whose height is the observed maximum stack height.

Each item is a closed-open interval together with the peak height that applies throughout that interval.

If the stack has no positive-height segments, the iterator is empty.

This is equivalent to:

iter_height_segments_exactly(height_stats.max_height())
Source§

impl<I> IntCOStack<I>

Source

pub fn iter_windows( &self, from: I::CoordType, to: I::CoordType, len: I::MeasureType, ) -> impl DoubleEndedIterator<Item = StackWindow<'_, I>> + ExactSizeIterator

Iterates over all fixed-length windows fully contained in [from, to).

Window starts advance by one coordinate unit:

[from,     from + len)
[from + 1, from + 1 + len)
...

Returns an empty iterator when:

  • from >= to;
  • len == 0;
  • len is greater than the measure of [from, to);
  • the window count cannot be represented as usize.
Source

pub fn par_iter_windows( &self, from: I::CoordType, to: I::CoordType, len: I::MeasureType, ) -> impl IndexedParallelIterator<Item = StackWindow<'_, I>>
where I: Send + Sync,

Iterates in parallel over all fixed-length windows fully contained in [from, to).

The valid window-start range is represented as an indexed integer range, allowing Rayon to split the work directly without a serial producer or par_bridge.

Trait Implementations§

Source§

impl<I> Clone for IntCOStack<I>
where I: IntCO,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<I> Debug for IntCOStack<I>
where I: IntCO + Debug, I::CoordType: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<I> Default for IntCOStack<I>
where I: IntCO,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<I> Eq for IntCOStack<I>
where I: IntCO,

Source§

impl<I> FromIterator<I> for IntCOStack<I>
where I: IntCO + Copy,

Source§

fn from_iter<T>(iter: T) -> Self
where T: IntoIterator<Item = I>,

Creates a value from an iterator. Read more
Source§

impl<I> FromParallelIterator<I> for IntCOStack<I>
where I: IntCO + Copy + Send,

Source§

fn from_par_iter<T>(par_iter: T) -> Self
where T: IntoParallelIterator<Item = I>,

Builds a stack from intervals in parallel.

Each worker accumulates endpoint-derived stack parts locally. The final reduction merges those parts into one canonical height function.

The covered set is not built during construction. It is a derived cache and is initialized lazily when the covered view is first requested.

Source§

impl<I> PartialEq for IntCOStack<I>
where I: IntCO,

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl<I> !Freeze for IntCOStack<I>

§

impl<I> RefUnwindSafe for IntCOStack<I>

§

impl<I> Send for IntCOStack<I>
where I: Sync + Send,

§

impl<I> Sync for IntCOStack<I>
where I: Sync + Send,

§

impl<I> Unpin for IntCOStack<I>

§

impl<I> UnsafeUnpin for IntCOStack<I>

§

impl<I> UnwindSafe for IntCOStack<I>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.