#interning #string-interning #globally

no-std symbol

Simple globally interned strings

9 releases

Uses old Rust 2015

0.1.9 Nov 19, 2021
0.1.8 Nov 11, 2021
0.1.7 Nov 14, 2018
0.1.6 Oct 14, 2018
0.1.1 Jan 21, 2018

#4 in #globally

Download history 48/week @ 2024-07-25 40/week @ 2024-08-01 42/week @ 2024-08-08 41/week @ 2024-08-15 40/week @ 2024-08-22 48/week @ 2024-08-29 35/week @ 2024-09-05 38/week @ 2024-09-12 36/week @ 2024-09-19 16/week @ 2024-09-26 13/week @ 2024-10-03 36/week @ 2024-10-10 37/week @ 2024-10-17 38/week @ 2024-10-24 41/week @ 2024-10-31 26/week @ 2024-11-07

147 downloads per month
Used in evaltrees

Apache-2.0/MIT

8KB
152 lines

symbol

Build Status Crates.io Documentation License

Simple globally interned strings.

Features and Optional Dependencies

gc: Symbol impls Trace and Finalize if the gc feature is enabled.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


lib.rs:

Simple globally interned strings.

Usage

let s1: Symbol = "asdf".into();
assert_eq!(s1, "asdf");

let s2: Symbol = "asdf".into();
let s3: Symbol = "qwerty".into();

assert_eq!(s1, s2);
assert_eq!(s1.addr(), s2.addr());

assert_ne!(s2.addr(), s3.addr());

let s4 = Symbol::gensym();
assert_eq!(s4, "G#0");

let s5: Symbol = "G#1".into();
assert_eq!(s5, "G#1");

// symbol notices that G#1 is in use
let s6 = Symbol::gensym();
assert_eq!(s6, "G#2");

Dependencies

~165–420KB