pub struct TextSelection<P> { /* private fields */ }Expand description
anchor/focus 选区。anchor 不随扩展方向变化,focus 即光标。
Implementations§
Source§impl<P: Clone + Ord> TextSelection<P>
impl<P: Clone + Ord> TextSelection<P>
pub fn new(anchor: P, focus: P) -> Self
pub fn collapsed(pos: P) -> Self
Sourcepub fn from_range(a: P, b: P) -> Self
pub fn from_range(a: P, b: P) -> Self
从归一化区间构造:anchor = start,focus = end(光标在 focus 端)。
pub fn anchor(&self) -> &P
pub fn focus(&self) -> &P
pub fn is_empty(&self) -> bool
pub fn range(&self) -> (P, P)
pub fn set_anchor(&mut self, pos: P)
pub fn collapse_to(&mut self, pos: P)
pub fn set_focus(&mut self, pos: P)
Trait Implementations§
Source§impl<P: Clone> Clone for TextSelection<P>
impl<P: Clone> Clone for TextSelection<P>
Source§impl<P: Debug> Debug for TextSelection<P>
impl<P: Debug> Debug for TextSelection<P>
impl<P: Eq> Eq for TextSelection<P>
Source§impl<P: PartialEq> PartialEq for TextSelection<P>
impl<P: PartialEq> PartialEq for TextSelection<P>
impl<P: PartialEq> StructuralPartialEq for TextSelection<P>
Auto Trait Implementations§
impl<P> Forget for TextSelection<P>
impl<P> Freeze for TextSelection<P>where
P: Freeze,
impl<P> Move for TextSelection<P>
impl<P> RefUnwindSafe for TextSelection<P>where
P: RefUnwindSafe,
impl<P> Send for TextSelection<P>where
P: Send,
impl<P> Sync for TextSelection<P>where
P: Sync,
impl<P> Unpin for TextSelection<P>where
P: Unpin,
impl<P> UnsafeUnpin for TextSelection<P>where
P: UnsafeUnpin,
impl<P> UnwindSafe for TextSelection<P>where
P: UnwindSafe,
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