Returns an inline name directly, or a shared clone of a heap-allocated name.
(&mut self, text: &str)
| 47 | impl NameInterner { |
| 48 | /// Returns an inline name directly, or a shared clone of a heap-allocated name. |
| 49 | fn intern(&mut self, text: &str) -> Name { |
| 50 | if let Some(name) = Name::new_inline(text) { |
| 51 | return name; |
| 52 | } |
| 53 | |
| 54 | self.names |
| 55 | .get_or_insert_with(text, |text| Name::new_heap(text)) |
| 56 | .clone() |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | #[derive(Debug)] |
no test coverage detected