int-interval-stack 0.3.1

Integer half-open interval stack structures for overlap multiplicity.
Documentation
use core::num::NonZeroUsize;

use super::*;

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct HeightSegment<I>
where
    I: IntCO,
{
    /// Closed-open interval on which the positive stack height is constant.
    pub interval: I,

    /// Positive stack height throughout `interval`.
    pub height: NonZeroUsize,
}

impl<I> From<HeightSegment<I>> for HeightRun<I>
where
    I: IntCO,
{
    #[inline]
    fn from(segment: HeightSegment<I>) -> Self {
        Self {
            interval: segment.interval,
            height: segment.height.get(),
        }
    }
}