Crates.io | porous |
lib.rs | porous |
version | 0.1.0 |
source | src |
created_at | 2023-08-24 01:53:54.031256 |
updated_at | 2023-08-24 01:53:54.031256 |
description | Non-contigous range implementation |
homepage | |
repository | https://git.43615.xyz/voidentente/porous |
max_upload_size | |
id | 953214 |
size | 4,256 |
step_trait
is required for marking the generic Item
as iterable.
See the requirement for RangeInclusive::into_iter
.
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 PorousRange
n \ PorousRange
n + 1 = { item
}.
serde
: Implement Serialize
and Deserialize
on PorousRange