pub struct TextCaret {
pub start: usize,
pub end: usize,
}Expand description
Byte-offset describing the text caret / a text selection on an editable node.
Offsets are byte indices into the UTF-8 representation of the
crate::tree::A11yNode::text_content string. The tree builder
translates them into AccessKit’s accesskit::TextSelection /
accesskit::TextPosition coordinates by synthesising a child
accesskit::Role::TextRun node carrying the text’s character-length
table.
For a pure caret (no selection), set TextCaret::start and
TextCaret::end to the same value.
Fields§
§start: usizeByte offset of the selection anchor (does not move while extending).
end: usizeByte offset of the selection focus (moves while extending).
Implementations§
Source§impl TextCaret
impl TextCaret
Sourcepub const fn caret(pos: usize) -> Self
pub const fn caret(pos: usize) -> Self
Construct a degenerate selection at byte offset pos (i.e. a caret).
Trait Implementations§
impl Copy for TextCaret
impl Eq for TextCaret
impl StructuralPartialEq for TextCaret
Auto Trait Implementations§
impl Freeze for TextCaret
impl RefUnwindSafe for TextCaret
impl Send for TextCaret
impl Sync for TextCaret
impl Unpin for TextCaret
impl UnsafeUnpin for TextCaret
impl UnwindSafe for TextCaret
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more