Skip to content
/ classific Public

A Rust library for classifications like comparators and equivalence classes.

Notifications You must be signed in to change notification settings

pozs/classific

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);
}

About

A Rust library for classifications like comparators and equivalence classes.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages