Skip to main content

int_interval_stack/
height_segment.rs

1use core::num::NonZeroUsize;
2
3use super::*;
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq)]
6pub struct HeightSegment<I>
7where
8    I: IntCO,
9{
10    /// Closed-open interval on which the positive stack height is constant.
11    pub interval: I,
12
13    /// Positive stack height throughout `interval`.
14    pub height: NonZeroUsize,
15}
16
17impl<I> From<HeightSegment<I>> for HeightRun<I>
18where
19    I: IntCO,
20{
21    #[inline]
22    fn from(segment: HeightSegment<I>) -> Self {
23        Self {
24            interval: segment.interval,
25            height: segment.height.get(),
26        }
27    }
28}