Implement From<&str> for Symbol.

This commit is contained in:
Eduard-Mihai Burtescu 2017-08-31 23:23:52 +03:00
parent 890c87b643
commit 9988e798c0

View file

@ -115,6 +115,12 @@ impl Symbol {
}
}
impl<'a> From<&'a str> for Symbol {
fn from(string: &'a str) -> Symbol {
Symbol::intern(string)
}
}
impl fmt::Debug for Symbol {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}({})", self, self.0)