[][src]Crate symbol

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");

Structs

Symbol

An interned string with O(1) equality.