string-cache
A string interning library for Rust, developed as part of the Servo project.
Simple usage
In Cargo.toml:
[]
= "0.11"
In lib.rs:
use DefaultAtom as Atom;
With static atoms
In Cargo.toml, corresponding versions of the two crates must be used:
[]
= "build.rs"
[]
= "0.11"
[]
= "0.11"
In build.rs:
use env;
use Path;
In lib.rs:
The generated code will define a FooAtom type and a foo_atom! macro.
The macro can be used in expression or patterns, with strings listed in build.rs.
For example: