pub struct LineIndex { /* private fields */ }Expand description
The start of every line in a text, for turning offsets into lines and columns. CR LF, CR, LF and form feed each end a line, as CSS counts.
use parsec_css::LineIndex;
let css = "a {\r\n color: réd;\n}";
let lines = LineIndex::new(css);
let at = css.find("réd").unwrap();
assert_eq!(lines.line_column(css, at), (2, 10));
assert_eq!(lines.line_column(css, css.len()), (3, 2));Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Forget for LineIndex
impl Freeze for LineIndex
impl Move for LineIndex
impl RefUnwindSafe for LineIndex
impl Send for LineIndex
impl Sync for LineIndex
impl Unpin for LineIndex
impl UnsafeUnpin for LineIndex
impl UnwindSafe for LineIndex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more