Commit 0cf93bb
authored
Auto merge of #238 - leops:try_static, r=jdm
Add an Atom::try_static method
This methods returns a new static Atom, or None if the provided string is not present in the static table. This is an optimization when using this library to speed up matching against a large table of static atoms, as it allows to skip locking the global table and inserting the new string when the match is going to fail anyway.
I'm not too sure about the name of the method but nothing better comes to mind right now, and same goes for the specifics of the implementation (I moved the hash calculation to a private method to limit code duplication but it's only three lines so it's probably not that important, plus returning the Hashes in Result::Err seems dubious)2 files changed
+24
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
293 | 299 | | |
294 | 300 | | |
295 | 301 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
152 | 168 | | |
153 | 169 | | |
154 | 170 | | |
| |||
170 | 186 | | |
171 | 187 | | |
172 | 188 | | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
| 189 | + | |
180 | 190 | | |
181 | 191 | | |
182 | 192 | | |
| |||
200 | 210 | | |
201 | 211 | | |
202 | 212 | | |
203 | | - | |
| 213 | + | |
204 | 214 | | |
205 | 215 | | |
206 | 216 | | |
| |||
0 commit comments