pub struct PositionWithAffinity {
pub offset: usize,
pub downstream: bool,
}Expand description
PositionWithAffinity identifies where to place a caret in editable text.
It is returned by Paragraph::glyph_position_at when mapping a pointer
position back to text. At line wraps and bidirectional boundaries, one text
offset can have two visual caret positions. Affinity selects whether the
caret belongs with the text before or after that offset.
Fields§
§offset: usizeoffset is a UTF-8 byte offset in paragraph text.
downstream: booldownstream selects the text after the offset when true, or before it when false.
Trait Implementations§
Source§impl Clone for PositionWithAffinity
impl Clone for PositionWithAffinity
Source§fn clone(&self) -> PositionWithAffinity
fn clone(&self) -> PositionWithAffinity
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 PositionWithAffinity
Source§impl Debug for PositionWithAffinity
impl Debug for PositionWithAffinity
impl Eq for PositionWithAffinity
Source§impl PartialEq for PositionWithAffinity
impl PartialEq for PositionWithAffinity
impl StructuralPartialEq for PositionWithAffinity
Auto Trait Implementations§
impl Freeze for PositionWithAffinity
impl RefUnwindSafe for PositionWithAffinity
impl Send for PositionWithAffinity
impl Sync for PositionWithAffinity
impl Unpin for PositionWithAffinity
impl UnsafeUnpin for PositionWithAffinity
impl UnwindSafe for PositionWithAffinity
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