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

#1556 in Rust patterns

Download history 96/week @ 2023-12-18 84/week @ 2023-12-25 86/week @ 2024-01-01 2/week @ 2024-01-08 63/week @ 2024-02-26 59/week @ 2024-03-04 57/week @ 2024-03-11 57/week @ 2024-03-18 40/week @ 2024-03-25 179/week @ 2024-04-01

343 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

~170–440KB