classific 0.1.4

Classifications, comparator and equivalence class implementations
Documentation
  • Coverage
  • 97.96%
    48 out of 49 items documented28 out of 48 items with examples
  • Size
  • Source code size: 33.9 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 9.66 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 11s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • pozs/classific
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • pozs

Classific Build Status

A Rust library for classifications like comparators and equivalence classes.

Links:

Usage

Add this to your Cargo.toml:

[dependencies]

classific = "0.1"

Examples

use classific::{Comparator, EqClass, comparing_with, reverse_order, eq_by};

#[derive(PartialEq, Eq, Debug)]
struct Person<'a> {
    name: &'a str,
    age: u8,
}

fn main() {
    let foo = Person {
        name: "Foo",
        age: 32,
    };
    let bar = Person {
        name: "Bar",
        age: 32,
    };

    assert!(eq_by(|p: &Person| p.age).eq(&foo, &bar));
    assert_eq!(comparing_with(|p: &Person| p.name, reverse_order()).max(&foo, &bar), &bar);
}