string_sections/lib.rs
1mod line_span;
2mod section_finder;
3mod section_iter;
4mod section_span;
5
6pub mod prelude;
7
8use std::ops::Range;
9
10pub use line_span::LineSpan;
11pub use section_finder::{SectionFinder, SectionFnFinder};
12pub use section_iter::SectionIter;
13pub use section_span::SectionSpan;
14
15fn str_to_range_unchecked(string: &str, substring: &str) -> Range<usize> {
16 let start = (substring.as_ptr() as usize) - (string.as_ptr() as usize);
17 let end = start + substring.len();
18
19 start..end
20}