pub struct Cursor {
pub blink_speed: Duration,
pub style: Style,
pub text_style: Style,
/* private fields */
}Expand description
A cursor component for text input.
Fields§
§blink_speed: DurationThe blink speed.
style: StyleStyle for the cursor block.
text_style: StyleStyle for text when cursor is hidden (blinking off).
Implementations§
Source§impl Cursor
impl Cursor
Sourcepub fn set_mode(&mut self, mode: Mode) -> Option<Cmd>
pub fn set_mode(&mut self, mode: Mode) -> Option<Cmd>
Sets the cursor mode.
Returns a command to start blinking if the mode is Blink.
Sourcepub fn is_blinking_off(&self) -> bool
pub fn is_blinking_off(&self) -> bool
Returns whether the cursor is currently in its “off” blink state.
Sourcepub fn focus(&mut self) -> Option<Cmd>
pub fn focus(&mut self) -> Option<Cmd>
Focuses the cursor, allowing it to blink if in blink mode.
Returns a command to start blinking.
Trait Implementations§
Source§impl Model for Cursor
impl Model for Cursor
Source§fn init(&self) -> Option<Cmd>
fn init(&self) -> Option<Cmd>
Initialize the cursor and return a blink command if in blink mode and focused.
Source§fn update(&mut self, msg: Message) -> Option<Cmd>
fn update(&mut self, msg: Message) -> Option<Cmd>
Update the cursor state based on incoming messages.
Handles:
InitialBlinkMsg- Start blinking if focused and in blink modeFocusMsg- Focus the cursor and start blinkingBlurMsg- Blur the cursor and stop blinkingBlinkMsg- Toggle blink state and schedule next blink
Auto Trait Implementations§
impl Freeze for Cursor
impl !RefUnwindSafe for Cursor
impl Send for Cursor
impl Sync for Cursor
impl Unpin for Cursor
impl !UnwindSafe for Cursor
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