Struct Cursor
pub struct Cursor { /* private fields */ }Expand description
Defines a position with a text layout.
Implementations§
§impl Cursor
impl Cursor
pub fn from_byte_index<B>(
layout: &Layout<B>,
index: usize,
affinity: Affinity,
) -> Cursorwhere
B: Brush,
pub fn from_byte_index<B>(
layout: &Layout<B>,
index: usize,
affinity: Affinity,
) -> Cursorwhere
B: Brush,
Creates a new cursor from the given byte index and affinity.
pub fn from_point<B>(layout: &Layout<B>, x: f32, y: f32) -> Cursorwhere
B: Brush,
pub fn from_point<B>(layout: &Layout<B>, x: f32, y: f32) -> Cursorwhere
B: Brush,
Creates a new cursor from the given coordinates.
pub fn affinity(&self) -> Affinity
pub fn affinity(&self) -> Affinity
Returns the affinity of the cursor.
This defines the direction from which the cursor entered its current position and affects the visual location of the rendered cursor.
pub fn refresh<B>(&self, layout: &Layout<B>) -> Cursorwhere
B: Brush,
pub fn refresh<B>(&self, layout: &Layout<B>) -> Cursorwhere
B: Brush,
Returns a new cursor that is guaranteed to be within the bounds of the given layout.
pub fn previous_visual<B>(&self, layout: &Layout<B>) -> Cursorwhere
B: Brush,
pub fn previous_visual<B>(&self, layout: &Layout<B>) -> Cursorwhere
B: Brush,
Returns a new cursor that is positioned at the previous cluster boundary in visual order.
pub fn next_visual<B>(&self, layout: &Layout<B>) -> Cursorwhere
B: Brush,
pub fn next_visual<B>(&self, layout: &Layout<B>) -> Cursorwhere
B: Brush,
Returns a new cursor that is positioned at the next cluster boundary in visual order.
pub fn next_visual_word<B>(&self, layout: &Layout<B>) -> Cursorwhere
B: Brush,
pub fn next_visual_word<B>(&self, layout: &Layout<B>) -> Cursorwhere
B: Brush,
Returns a new cursor that is positioned at the next word boundary in visual order.
pub fn previous_visual_word<B>(&self, layout: &Layout<B>) -> Cursorwhere
B: Brush,
pub fn previous_visual_word<B>(&self, layout: &Layout<B>) -> Cursorwhere
B: Brush,
Returns a new cursor that is positioned at the previous word boundary in visual order.
pub fn next_logical_word<B>(&self, layout: &Layout<B>) -> Cursorwhere
B: Brush,
pub fn next_logical_word<B>(&self, layout: &Layout<B>) -> Cursorwhere
B: Brush,
Returns a new cursor that is positioned at the next word boundary in logical order.
pub fn previous_logical_word<B>(&self, layout: &Layout<B>) -> Cursorwhere
B: Brush,
pub fn previous_logical_word<B>(&self, layout: &Layout<B>) -> Cursorwhere
B: Brush,
Returns a new cursor that is positioned at the previous word boundary in logical order.
pub fn geometry<B>(&self, layout: &Layout<B>, width: f32) -> BoundingBoxwhere
B: Brush,
pub fn geometry<B>(&self, layout: &Layout<B>, width: f32) -> BoundingBoxwhere
B: Brush,
Returns a rectangle that represents the visual geometry of the cursor in layout space.
The width parameter defines the width of the resulting rectangle.
pub fn logical_clusters<'a, B>(
&self,
layout: &'a Layout<B>,
) -> [Option<Cluster<'a, B>>; 2]where
B: Brush,
pub fn logical_clusters<'a, B>(
&self,
layout: &'a Layout<B>,
) -> [Option<Cluster<'a, B>>; 2]where
B: Brush,
Returns the pair of clusters that logically bound the cursor position.
The order in the array is upstream followed by downstream.
pub fn visual_clusters<'a, B>(
&self,
layout: &'a Layout<B>,
) -> [Option<Cluster<'a, B>>; 2]where
B: Brush,
pub fn visual_clusters<'a, B>(
&self,
layout: &'a Layout<B>,
) -> [Option<Cluster<'a, B>>; 2]where
B: Brush,
Returns the pair of clusters that visually bound the cursor position.
The order in the array is left followed by right.
Trait Implementations§
impl Copy for Cursor
impl Eq for Cursor
impl StructuralPartialEq for Cursor
Auto Trait Implementations§
impl Freeze for Cursor
impl RefUnwindSafe for Cursor
impl Send for Cursor
impl Sync for Cursor
impl Unpin for Cursor
impl UnsafeUnpin for Cursor
impl UnwindSafe for Cursor
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().