Skip to main content

CursorStyle

Enum CursorStyle 

Source
pub enum CursorStyle {
    Default,
    BlinkingBlock,
    SteadyBlock,
    BlinkingUnderline,
    SteadyUnderline,
    BlinkingBar,
    SteadyBar,
}
Expand description

Cursor style values for DECSCUSR (ESC [ Ps SP q).

The variants map directly to the numeric Ps parameter used by write_cursor_style.

Variants§

§

Default

Terminal default, DECSCUSR parameter 0.

Writing this asks the terminal for the cursor its user configured. kitty, foot, rio, Alacritty, VTE, Konsole and Windows Terminal all read the shape back from configuration here, so it is the way to hand the cursor back at the end of a session. xterm documents 0 as a blinking block instead, which matches none of them.

What it draws is therefore not knowable from the parameter: it is whatever that user chose, and terminals do not even agree on the blink, with kitty and Windows Terminal forcing it on where the others restore it from configuration too. So this names no shape and no blink state, and shape and blinking answer None for it. Ask with Program::request_cursor_style when you need to know what the cursor actually is.

§

BlinkingBlock

Blinking block cursor, DECSCUSR parameter 1.

§

SteadyBlock

Steady block cursor, DECSCUSR parameter 2.

§

BlinkingUnderline

Blinking underline cursor, DECSCUSR parameter 3.

§

SteadyUnderline

Steady underline cursor, DECSCUSR parameter 4.

§

BlinkingBar

Blinking bar cursor, DECSCUSR parameter 5.

§

SteadyBar

Steady bar cursor, DECSCUSR parameter 6.

Implementations§

Source§

impl CursorStyle

Source

pub fn from_param(n: u32) -> Option<Self>

The style a DECSCUSR parameter selects.

§Returns

None for a parameter outside 0..=6, which selects no style this library knows. Used to read the style back out of a DECRPSS reply.

Source

pub fn new(shape: CursorShape, blinking: bool) -> Self

The style that draws shape, blinking or steady.

Source

pub fn shape(self) -> Option<CursorShape>

The shape this style draws.

§Returns

None for CursorStyle::Default, which defers to the terminal rather than naming a shape.

Source

pub fn blinking(self) -> Option<bool>

Whether this style blinks.

§Returns

None for CursorStyle::Default, which defers to the terminal rather than choosing.

Trait Implementations§

Source§

impl Clone for CursorStyle

Source§

fn clone(&self) -> CursorStyle

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for CursorStyle

Source§

impl Debug for CursorStyle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CursorStyle

Source§

fn default() -> CursorStyle

Returns the “default value” for a type. Read more
Source§

impl Eq for CursorStyle

Source§

impl Hash for CursorStyle

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for CursorStyle

Source§

fn eq(&self, other: &CursorStyle) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CursorStyle

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.