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
147 downloads per month
Used in evaltrees
8KB
152 lines
symbol
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
- Apache License, Version 2.0, (http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (http://opensource.org/licenses/MIT)
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