pub struct Point { /* private fields */ }Expand description
A position in Text.
This position is composed of a byte index, a character index, and
a line index, all from the start of the Text.
Implementations§
Source§impl Point
impl Point
Sourcepub const fn to_two_points_before(self) -> TwoPoints
pub const fn to_two_points_before(self) -> TwoPoints
Sourcepub const fn to_two_points_after(self) -> TwoPoints
pub const fn to_two_points_after(self) -> TwoPoints
Sourcepub fn end_point_of(str: impl AsRef<str>) -> Self
pub fn end_point_of(str: impl AsRef<str>) -> Self
This is the equivalent of Strs::end_point, but for types
other than Text
Sourcepub const fn byte(&self) -> usize
pub const fn byte(&self) -> usize
Returns the byte (relative to the beginning of the buffer) of self. Indexed at 0.
You can use byte indices to index the Text, Strs, or
Tags with the Strs::point_at_byte function.
Trait Implementations§
Source§impl AddAssign for Point
impl AddAssign for Point
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moreSource§impl<'__de, __Context> BorrowDecode<'__de, __Context> for Point
impl<'__de, __Context> BorrowDecode<'__de, __Context> for Point
Source§fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Attempt to decode this type with the given BorrowDecode.
Source§impl Ord for Point
impl Ord for Point
Source§impl PartialOrd for Point
impl PartialOrd for Point
Source§impl SubAssign for Point
impl SubAssign for Point
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-= operation. Read moreSource§impl TextIndex for Point
impl TextIndex for Point
Source§fn to_byte_index(self) -> usize
fn to_byte_index(self) -> usize
Converts this type into a byte index.
Source§impl TextRangeOrIndex for Point
impl TextRangeOrIndex for Point
impl CaretOrRange for Point
impl Copy for Point
impl Eq for Point
impl StructuralPartialEq for Point
Auto Trait Implementations§
impl Freeze for Point
impl RefUnwindSafe for Point
impl Send for Point
impl Sync for Point
impl Unpin for Point
impl UnsafeUnpin for Point
impl UnwindSafe for Point
Blanket Implementations§
Source§impl<D> AsBuilderPart<D, D> for Dwhere
D: Display,
impl<D> AsBuilderPart<D, D> for Dwhere
D: Display,
Source§fn as_builder_part(&self) -> BuilderPart<'_, D, D>
fn as_builder_part(&self) -> BuilderPart<'_, D, D>
Gets a
BuilderPart fro this valueSource§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