stdng

Crates.iostdng
lib.rsstdng
version0.1.6
sourcesrc
created_at2023-12-26 02:25:43.475403
updated_at2024-02-24 01:53:21.594706
descriptionAn enhancement for Rust standard library
homepage
repositoryhttps://github.com/xflops/stdng
max_upload_size
id1080573
size18,241
Klaus Ma (k82cn)

documentation

README

stdng

The enhancement of Rust stand library

Example

BinaryHeap

use std::cmp::Ordering;

use stdng::collections::BinaryHeap;

struct IntCmpR {}

impl Cmp<i32> for IntCmpR {
    fn cmp(&self, t1: &i32, t2: &i32) -> Ordering {
        match t1.cmp(t2) {
            Ordering::Greater => Ordering::Less,
            Ordering::Less => Ordering::Greater,
            Ordering::Equal => Ordering::Equal,
        }
    }
}

fn main() {
    let mut head = BinaryHeap::new(IntCmpR {});
    head.push(1);
    head.push(2);

    let i = head.pop();
    assert_eq!(Some(1), i);
}
Commit count: 18

cargo fmt