cu29-intern-strs

Crates.iocu29-intern-strs
lib.rscu29-intern-strs
version0.9.1
created_at2024-07-29 18:09:42.621524+00
updated_at2025-09-12 20:20:06.225559+00
descriptionThis is loader for the intern strings logged at build time by Copper. It can be used independently from the copper project.
homepagehttps://github.com/copper-project
repositoryhttps://github.com/copper-project/copper-rs
max_upload_size
id1319082
size25,233
Guillaume Binet (gbin)

documentation

https://docs.rs/cu29-intern-strs

README

cu29-intern-strs is a library to manage and intern strings in Rust

(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.

Usage

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"));
}
Commit count: 741

cargo fmt