Nutype 0.3 released

Github: GitHub - greyblake/nutype: Rust newtype with guarantees 馃嚭馃嚘 馃
Release notes: Release Nutype 0.3.0 路 greyblake/nutype 路 GitHub
Blog post: Nutype 0.3.0 released | Sergey Potapov (greyblake)

In the new version one now can derive Ord and Eq on float-based types.
This became possible due to finite validation, which excludes NaN variants, which cannot be compared.

use nutype::nutype;

#[nutype(validate(finite))]
#[derive(PartialEq, Eq, PartialOrd, Ord)]
struct Distance(f64);

fn main() {
    let distance = Distance::new(12.0).unwrap();
}
2 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.