Commit c9dce1b
committed
core: add internal core::str_bytes module handling string-like slices
Introduce a new core::str_bytes module with types and functions which
handle string-like bytes slices. String-like means that they code
treats UTF-8 byte sequences as characters within such slices but
doesn’t assume that the slices are well-formed.
A `str` is trivially a bytes sequence that the module can handle but
so is OsStr (which is WTF-8 on Windows and unstructured bytes on
Unix).
Move bunch of code (most notably implementation of the two-way
string-matching algorithm) from core::str to core::str_bytes.
Note that this likely introduces regression in some of the str
function performance (since the new code cannot assume well-formed
UTF-8). This is going to be rectified by following commit which will
make it again possible for the code to assume bytes format. This is
not done in this commit to keep it smaller.1 parent cc9bf61 commit c9dce1b
File tree
6 files changed
+1520
-836
lines changed- library
- alloc/tests
- core
- src
- str
- tests
6 files changed
+1520
-836
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1972 | 1972 | | |
1973 | 1973 | | |
1974 | 1974 | | |
1975 | | - | |
| 1975 | + | |
1976 | 1976 | | |
1977 | 1977 | | |
1978 | 1978 | | |
| |||
2008 | 2008 | | |
2009 | 2009 | | |
2010 | 2010 | | |
2011 | | - | |
| 2011 | + | |
2012 | 2012 | | |
2013 | 2013 | | |
2014 | 2014 | | |
2015 | 2015 | | |
2016 | 2016 | | |
2017 | | - | |
| 2017 | + | |
2018 | 2018 | | |
2019 | 2019 | | |
2020 | 2020 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
| 368 | + | |
| 369 | + | |
368 | 370 | | |
369 | 371 | | |
370 | 372 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
214 | 227 | | |
215 | 228 | | |
216 | 229 | | |
| |||
232 | 245 | | |
233 | 246 | | |
234 | 247 | | |
| 248 | + | |
235 | 249 | | |
236 | 250 | | |
237 | 251 | | |
| |||
246 | 260 | | |
247 | 261 | | |
248 | 262 | | |
| 263 | + | |
249 | 264 | | |
250 | 265 | | |
251 | 266 | | |
| |||
260 | 275 | | |
261 | 276 | | |
262 | 277 | | |
| 278 | + | |
263 | 279 | | |
264 | 280 | | |
265 | 281 | | |
| |||
0 commit comments