#collation #bisect #stream #traits #bisection #utilities #merge

collate

Traits and a data structure to support collation and bisection

18 releases

0.4.1 Dec 20, 2023
0.4.0 Nov 6, 2023
0.3.0 Jul 3, 2023
0.2.4 Jan 21, 2023
0.1.1 Jan 18, 2021

#1 in #bisect

Download history 155/week @ 2023-12-18 36/week @ 2023-12-25 20/week @ 2024-01-01 19/week @ 2024-01-08 9/week @ 2024-01-15 41/week @ 2024-01-22 51/week @ 2024-01-29 13/week @ 2024-02-05 34/week @ 2024-02-12 37/week @ 2024-02-19 99/week @ 2024-02-26 49/week @ 2024-03-04 77/week @ 2024-03-11 149/week @ 2024-03-18 283/week @ 2024-03-25 245/week @ 2024-04-01

766 downloads per month
Used in 21 crates (9 directly)

Apache-2.0

36KB
807 lines

collate

Rust collation utilities

Example usage:

use collate::*;

let collator = Collator::default();
let collection = [
    [1, 2, 3],
    [2, 3, 4],
    [3, 4, 5],
];

assert_eq!(collator.bisect_left(&collection, &[1]), 0);
assert_eq!(collator.bisect_right(&collection, &[1]), 1);

lib.rs:

Defines a Collate trait to standardize collation methods across data types. The provided Collator struct can be used to collate a collection of items of type T where T: Ord.

Collate is useful for implementing a B-Tree, or to handle cases where a collator type is more efficient than calling Ord::cmp repeatedly, for example when collating localized strings using rust_icu_ucol. It's also useful to handle types like complex numbers which do not necessarily have a natural ordering.

Use the "stream" feature flag to enable diff and try_diff functions to compute the difference between two collated Streams, and the merge and try_merge functions to merge two collated Streams.

Dependencies

~0–260KB