Crates.io | char_index |
lib.rs | char_index |
version | 0.1.4 |
source | src |
created_at | 2023-08-28 02:01:51.99506 |
updated_at | 2024-10-26 01:16:09.417321 |
description | A crate for efficient charwise indexing into a string |
homepage | https://github.com/unicode-entropy/char_index |
repository | https://github.com/unicode-entropy/char_index |
max_upload_size | |
id | 956541 |
size | 38,143 |
A crate for ~O(1) charwise indexing into a string, without normally using as much memory as a Vec<char>
.
1000 "e"'s with 3 extra non ascii chars, shuffled:
Implementation | Memory Use | Index 200th codepoint |
---|---|---|
Vec<char> |
4,012B (+ 24B direct) | 0.6ns |
IndexedChars |
2,009B (+ 64B direct) | 4ns |
String |
1,006B (+ 24B direct) | 126ns |
(data collected using benches/char_index.rs
)
no_std
This crate is fully no_std
, however it does rely on alloc.
A std feature may be added at a later date, but it is currently unknown what that would include.
This crate is licensed under MPL-2.0, this is a weak copyleft license intended to keep any modifications to the core library open source, without affecting other requirements greatly. This is not legal advice.