Crates.io | ix-rs |
lib.rs | ix-rs |
version | 0.8.0 |
source | src |
created_at | 2023-03-10 23:55:10.912204 |
updated_at | 2023-08-16 12:07:15.494585 |
description | A trait for values that permit contiguous subranges |
homepage | |
repository | https://github.com/schuelermine/ix-rs |
max_upload_size | |
id | 806827 |
size | 13,699 |
A trait for values that permit contiguous subranges.
This is a port of the Ix
class from Haskell to a trait in Rust.
This crate provides the Ix
trait:
pub trait Ix: PartialOrd + Sized {
type Range: Iterator<Item = Self>;
// Required methods
fn range(min: Self, max: Self) -> Self::Range;
fn index_checked(self, min: Self, max: Self) -> Option<usize>;
fn in_range(self, min: Self, max: Self) -> bool;
fn range_size_checked(min: Self, max: Self) -> Option<usize>;
// Provided methods
fn index(self, min: Self, max: Self) -> usize { ... }
fn range_size(min: Self, max: Self) -> usize { ... }
}
See the documentation for more details.