1 unstable release

0.1.0 Aug 24, 2023

#253 in Simulation

MIT license

5KB
62 lines

Nightly Only

step_trait is required for marking the generic Item as iterable. See the requirement for RangeInclusive::into_iter.

About

 1 2 3 4 5 6 7 8         1 2 3 4 5 6 7 8
[---------------] - 4 = [-----] [-------]

The main structure this crate provides is PorousRange, which abstracts over an indefinite amount of ranges (i.e. requires allocation) to simulate one non-contigous one.

PorousRange accepts any inner generic item that is num_traits::One, core::iter::Step, core::marker::Copy, core::ops::Add, and core::ops::Sub. These requirements are fulfilled by every built-in integer.

An item is never contained in more than one inner range and can be removed, if it is contained, so that range is removed and up to two new ranges are pushed so that PorousRangen \ PorousRangen + 1 = { item }.

Features

  • serde: Implement Serialize and Deserialize on PorousRange

Dependencies

~95–325KB