pub struct RangeList<const N: usize, I> { /* private fields */ }
Expand description
Set of number stored as a set of non-adjacent, non-overlapping ranges
For a set with few gaps, this uses much less memory than a standard BTreeSet
Types
N
is the number of continuous ranges that can be stored without
needing to allocate space on the heap
I
is the integer used for the elements
Implementations§
source§impl<const N: usize, I> RangeList<N, I>where
I: PartialOrd + Add<Output = I> + One + Copy,
impl<const N: usize, I> RangeList<N, I>where I: PartialOrd + Add<Output = I> + One + Copy,
sourcepub fn insert_all<It: IntoIterator<Item = I>>(&mut self, items: It)
pub fn insert_all<It: IntoIterator<Item = I>>(&mut self, items: It)
Insert multiple elements from an iterator
sourcepub fn min_max_ranges(&self) -> impl Iterator<Item = RangeInclusive<I>> + '_where
I: Sub<Output = I>,
pub fn min_max_ranges(&self) -> impl Iterator<Item = RangeInclusive<I>> + '_where I: Sub<Output = I>,
Return an iterator over all inclusive ranges
pub fn serialize(&mut self, bs: &mut BitStreamWrite)where I: Sub<Output = I> + WriteSafe,
pub fn deserialize(bs: &mut BitStreamRead<'_>) -> Result<Self>where I: ReadSafe,
Trait Implementations§
source§impl<const N: usize, I> Debug for RangeList<N, I>where
I: Add<Output = I> + One + PartialEq + Copy + Debug,
impl<const N: usize, I> Debug for RangeList<N, I>where I: Add<Output = I> + One + PartialEq + Copy + Debug,
source§impl<const N: usize, I: PartialEq> PartialEq<RangeList<N, I>> for RangeList<N, I>
impl<const N: usize, I: PartialEq> PartialEq<RangeList<N, I>> for RangeList<N, I>
impl<const N: usize, I: Eq> Eq for RangeList<N, I>
impl<const N: usize, I> StructuralEq for RangeList<N, I>
impl<const N: usize, I> StructuralPartialEq for RangeList<N, I>
Auto Trait Implementations§
impl<const N: usize, I> RefUnwindSafe for RangeList<N, I>where I: RefUnwindSafe,
impl<const N: usize, I> Send for RangeList<N, I>where I: Send,
impl<const N: usize, I> Sync for RangeList<N, I>where I: Sync,
impl<const N: usize, I> Unpin for RangeList<N, I>where I: Unpin,
impl<const N: usize, I> UnwindSafe for RangeList<N, I>where I: UnwindSafe + RefUnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more