#string-interning #symbols #string #interning

no-std stringleton-registry

Helper crate for the stringleton crate

2 releases

Uses new Rust 2024

new 0.1.1 Mar 27, 2025
0.1.0 Mar 27, 2025

#14 in #string-interning

32 downloads per month
Used in 2 crates

MIT/Apache

42KB
702 lines

Registry helper crate for stringleton

You probably don't need to use this crate directly. Use the stringleton crate or the stringleton-dylib crate instead.

This crate exists to support both static and dynamic linking when using stringleton.

All binaries in a process must use the same symbol registry, so when a dynamic library (dylib) dependency is using stringleton, this crate must also be compiled as a dynamic library, which is ensured by the linkage rules.

This only works automatically when such a dependency is "implicitly" linked (i.e. it is a direct dependency in Cargo.toml). If dynamic libraries are being loaded at runtime by the host process, Cargo must be instructed to dynamically link against the registry, which can be achieved by using the stringleton-dylib crate in the main binary instead of stringleton.

Note that if a dependency is a cdylib (crate-type), that dependency must explicitly link against stringleton-dylib for this trick to work. This is not necessary when building a normal Rust dylib.

Dependencies

~0.7–1.2MB
~19K SLoC