15 unstable releases (5 breaking)
| 0.6.1 | Jun 25, 2025 |
|---|---|
| 0.5.0 | Jun 23, 2025 |
| 0.3.0 | Jul 24, 2024 |
| 0.1.6 | Feb 27, 2024 |
| 0.1.5 | Nov 13, 2023 |
#512 in Text processing
87,018 downloads per month
Used in 8 crates
(via ui_test)
25KB
658 lines
Simple span handling for str and &[u8]
This crate exposes some of the methods that exist on str or bstr.
If you are missing any you need, please open issues or PRs.
The basic usage is to read from a file and then use the methods to modify it:
let file = Spanned::<String>::read_from_file(path)?;
for line in file.lines() {
if let Some(rest) = line.strip_prefix("cake:") {
println!("found a cake at {}: {}", rest.span.line_start, *rest);
}
}
any Spanned object will always know its file, line and column information and
correctly preserve it across operations that take subslices. The column information
is counted in the number of utf8 characters, which is not entirely correct.
Please open an issue if you encounter this to be a problem.
Dependencies
~5–17MB
~158K SLoC