pub enum TextPos {
Char(usize),
Line(usize),
End,
}Expand description
A position in the text for the bounds of a rewrite
range.
Resolves to a character index (0-based) for the half-open range [from, to).
A bare usize is treated as a character index (via From<usize>); [line]
sets the start of a line, infinite — the end of the text.
Variants§
Char(usize)
A character index (0-based, Unicode scalar). Clamped to [0, length].
Line(usize)
The start of line n (0-based) — the boundary before its first
character. Lines are separated by \n. An index past the last line is the
end of the text.
End
The end of the text. Valid primarily as to (for from it equals the
length, i.e. an empty range at the end). Constructed via infinite.
Trait Implementations§
impl Copy for TextPos
impl Eq for TextPos
impl StructuralPartialEq for TextPos
Auto Trait Implementations§
impl Freeze for TextPos
impl RefUnwindSafe for TextPos
impl Send for TextPos
impl Sync for TextPos
impl Unpin for TextPos
impl UnsafeUnpin for TextPos
impl UnwindSafe for TextPos
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