Inline Symbol::decode
and Interner::intern
.
This commit is contained in:
parent
ab906179cc
commit
c02d689a62
1 changed files with 2 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue