Crates.io | lexicon_fractional_index |
lib.rs | lexicon_fractional_index |
version | 0.0.4-a1 |
source | src |
created_at | 2021-12-07 06:35:04.537371 |
updated_at | 2022-01-17 05:48:45.630099 |
description | Fractional index implementation migrated from Go/JavaScript |
homepage | https://github.com/TODO/lexicon-fractional-index/ |
repository | https://github.com/TODO/lexicon-fractional-index/ |
max_upload_size | |
id | 493644 |
size | 44,574 |
A Rust version for fractional-indexing . Keys in string and satisfy lexicographic order.
Rewritten from existed codebase:
Docs.
use lexicon_fractional_index::key_between;
// create an initial key
let k0 = key_between(None, None)?;
// two keys, notice that some strings are not valid keys
let left = "Xb0M".to_owned();
let right = "Xb0M0V".to_owned();
// new key at beginning
let next = key_between(None, Some(&right))?;
// new key at end
let next = key_between(Some(&left), None)?;
// new key between 2 keys
let next = key_between(Some(&left), Some(&right))?;
TODO