pub struct TextAnchor {
pub offset: usize,
pub bias: AnchorBias,
}Expand description
A character-offset anchor that shifts through edits.
Offsets are expressed as Unicode scalar indices (Rust char offsets), consistent with the
rest of editor-core’s public API.
Fields§
§offset: usizeCharacter offset in the document.
bias: AnchorBiasTie-break behavior for insertions at the same offset.
Implementations§
Source§impl TextAnchor
impl TextAnchor
Sourcepub fn new(offset: usize, bias: AnchorBias) -> Self
pub fn new(offset: usize, bias: AnchorBias) -> Self
Create a new anchor.
Sourcepub fn apply_delta(&mut self, delta: &TextDelta)
pub fn apply_delta(&mut self, delta: &TextDelta)
Shift this anchor through a text delta.
Trait Implementations§
Source§impl Clone for TextAnchor
impl Clone for TextAnchor
Source§fn clone(&self) -> TextAnchor
fn clone(&self) -> TextAnchor
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for TextAnchor
Source§impl Debug for TextAnchor
impl Debug for TextAnchor
impl Eq for TextAnchor
Source§impl Hash for TextAnchor
impl Hash for TextAnchor
Source§impl PartialEq for TextAnchor
impl PartialEq for TextAnchor
Source§fn eq(&self, other: &TextAnchor) -> bool
fn eq(&self, other: &TextAnchor) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for TextAnchor
Auto Trait Implementations§
impl Freeze for TextAnchor
impl RefUnwindSafe for TextAnchor
impl Send for TextAnchor
impl Sync for TextAnchor
impl Unpin for TextAnchor
impl UnsafeUnpin for TextAnchor
impl UnwindSafe for TextAnchor
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