ix-rs

Crates.ioix-rs
lib.rsix-rs
version0.8.0
sourcesrc
created_at2023-03-10 23:55:10.912204
updated_at2023-08-16 12:07:15.494585
descriptionA trait for values that permit contiguous subranges
homepage
repositoryhttps://github.com/schuelermine/ix-rs
max_upload_size
id806827
size13,699
Anselm Schüler (schuelermine)

documentation

README

ix-rs

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.

Commit count: 19

cargo fmt