Inline Symbol::decode and Interner::intern.

This commit is contained in:
Nicholas Nethercote 2020-02-18 16:00:58 +11:00
parent ab906179cc
commit c02d689a62

View file

@ -993,6 +993,7 @@ impl Encodable for Symbol {
}
impl Decodable for Symbol {
#[inline]
fn decode<D: Decoder>(d: &mut D) -> Result<Symbol, D::Error> {
Ok(Symbol::intern(&d.read_str()?))
}
@ -1031,6 +1032,7 @@ impl Interner {
}
}
#[inline]
pub fn intern(&mut self, string: &str) -> Symbol {
if let Some(&name) = self.names.get(string) {
return name;