Skip to content

higumachan/unwrap-ord

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

unwrap-ord

Crates.io

Wrapper type to easily convert Ord to PartialOrd. inspired by std::cmp::Reverse

How to use

Add your Cargo.toml

unwrap-ord = "0.1.0"
use unwrap_ord::UnwrapOrd;

fn main() {
    let v = [1.0, 3.0, 2.0];
    let mut v: Vec<_> = v.iter().copied().map(|x| UnwrapOrd(x)).collect();

    v.sort();

    println!("{:?}", v);  // [UncheckOrd(1.0), UncheckOrd(2.0), UncheckOrd(3.0)]
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages