| Crates.io | cu29-intern-strs |
| lib.rs | cu29-intern-strs |
| version | 0.9.1 |
| created_at | 2024-07-29 18:09:42.621524+00 |
| updated_at | 2025-09-12 20:20:06.225559+00 |
| description | This is loader for the intern strings logged at build time by Copper. It can be used independently from the copper project. |
| homepage | https://github.com/copper-project |
| repository | https://github.com/copper-project/copper-rs |
| max_upload_size | |
| id | 1319082 |
| size | 25,233 |
(see the crate cu29-log-derive for example macros taking advantage of this library)
The concept is to extract strings from a source code file and intern them in an external database at compile time. This allows for efficient string management and reduces the size of the executable image.
All the strings are stored in a database file, which is generated at compile time and replaced by a simple index number (u32) in the executable.
To use this library, you need to add it as a dependency in your Cargo.toml file:
[dependencies]
cu29-intern-strs = { version = "*", feature = ["macros_debug"] }
To read the index after the fact:
use cu29_intern_strs::intern_strs;
fn main() {
let index = read_interned_strings("path/to/cu29_log_index"); // this file is generated at compile time
println!("Read string 42: {}", index.get(42).unwrap_or(&"String not found"));
}