pub trait LineSpans {
// Required method
fn line_spans(&self) -> LineSpanIter<'_> ⓘ;
}
Expand description
Trait which implements line_spans()
to get a LineSpanIter
.
use line_span::LineSpans;
let text = "foo\nbar\r\nbaz";
for span in text.line_spans() {
println!("{:>2?}: {:?}", span.range(), span.as_str());
}
This will output the following:
0.. 3: "foo"
4.. 7: "bar"
9..12: "baz"
Required Methods§
Sourcefn line_spans(&self) -> LineSpanIter<'_> ⓘ
fn line_spans(&self) -> LineSpanIter<'_> ⓘ
Creates a LineSpanIter
.