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

#1625 in Rust patterns

Download history 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 108/week @ 2024-04-01 48/week @ 2024-04-08 54/week @ 2024-04-15 31/week @ 2024-04-22 19/week @ 2024-04-29 30/week @ 2024-05-06 47/week @ 2024-05-13 47/week @ 2024-05-20 65/week @ 2024-05-27 54/week @ 2024-06-03 48/week @ 2024-06-10

220 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–435KB