Skip to main content

Command

Enum Command 

Source
#[non_exhaustive]
pub enum Command<'a> {
Show 26 variants MoveCursor(CursorMove), SaveCursorPosition, RestoreCursorPosition, SetCursorVisible(bool), SetCursorBlinking(bool), SetCursorAppearance(CursorAppearance), SetAlternateScreen(bool), SetBracketedPaste(bool), SetFocusReporting(bool), SetMouseCapture(bool), PushKeyboardEnhancement(KeyboardEnhancementFlags), PopKeyboardEnhancement, Clear(ClearRegion), Scroll(i32), SetSize(TerminalSize), SetTitle(TerminalText<'a>), SetLineWrap(bool), SetSynchronizedUpdate(bool), SetStyle(TerminalStyle), ResetStyle, SetHyperlink(Option<TerminalHyperlink<'a>>), ApplicationProgram(ControlString<'a>), DeviceControl(ControlString<'a>), Print(TerminalText<'a>), LineFeed, CarriageReturnLineFeed,
}
Expand description

One semantic terminal control or text-output operation.

Commands model terminal behavior rather than a backend library’s command types. A surface owns when commands run; a backend owns how they reach the terminal. Their conventional wire forms belong to the ANSI family: CSI sequences control cursor, modes, erasure, and SGR style; OSC strings carry titles and hyperlinks; printable UTF-8 and C0 line endings are raw bytes. An adapter may use native platform operations instead of those encodings.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

MoveCursor(CursorMove)

Moves the cursor using a CSI cursor-positioning or movement sequence.

§

SaveCursorPosition

Saves the cursor position using the backend’s ANSI/DEC save sequence.

§

RestoreCursorPosition

Restores the cursor position using the backend’s ANSI/DEC restore sequence.

§

SetCursorVisible(bool)

Shows or hides the cursor using a CSI private-mode sequence.

§

SetCursorBlinking(bool)

Enables or disables cursor blinking using a CSI private-mode sequence.

§

SetCursorAppearance(CursorAppearance)

Selects a cursor shape using a CSI cursor-style sequence.

§

SetAlternateScreen(bool)

Selects the primary or alternate screen using a CSI private-mode sequence.

§

SetBracketedPaste(bool)

Enables or disables bracketed-paste reporting using a CSI private-mode sequence.

§

SetFocusReporting(bool)

Enables or disables terminal-focus reporting using a CSI private-mode sequence.

§

SetMouseCapture(bool)

Enables or disables mouse reporting using CSI private-mode sequences.

§

PushKeyboardEnhancement(KeyboardEnhancementFlags)

Pushes enhanced-keyboard flags using the terminal’s CSI protocol.

§

PopKeyboardEnhancement

Pops the most recently pushed enhanced-keyboard flags using CSI.

§

Clear(ClearRegion)

Clears terminal content using a CSI erase sequence.

§

Scroll(i32)

Scrolls by signed rows. Positive values move content upward.

Backends normally lower this to CSI scroll-up or scroll-down sequences.

§

SetSize(TerminalSize)

Requests a terminal size using a CSI window-manipulation sequence.

§

SetTitle(TerminalText<'a>)

Sets the terminal title using an OSC control string.

§

SetLineWrap(bool)

Enables or disables automatic line wrapping using a CSI private-mode sequence.

§

SetSynchronizedUpdate(bool)

Begins or ends a synchronized update using a CSI private-mode sequence.

§

SetStyle(TerminalStyle)

Applies a complete physical text style using CSI SGR sequences.

§

ResetStyle

Restores the terminal’s default text style using CSI SGR sequences.

Starts or ends a hyperlink using an OSC 8 control string.

§

ApplicationProgram(ControlString<'a>)

Sends an ECMA-48 Application Program Command control string.

Extension crates use this transport for protocols such as Kitty graphics while retaining ownership of the protocol payload itself.

§

DeviceControl(ControlString<'a>)

Sends an ECMA-48 Device Control String.

Extension crates use this transport for protocols such as Sixel while retaining ownership of the protocol payload itself.

§

Print(TerminalText<'a>)

Writes the UTF-8 text bytes without interpreting them as terminal control data.

§

LineFeed

Writes the raw C0 line-feed byte without a carriage return.

§

CarriageReturnLineFeed

Writes raw C0 carriage-return and line-feed bytes.

Trait Implementations§

Source§

impl<'a> Clone for Command<'a>

Source§

fn clone(&self) -> Command<'a>

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<'a> Debug for Command<'a>

Source§

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

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

impl<'a> PartialEq for Command<'a>

Source§

fn eq(&self, other: &Command<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Copy for Command<'a>

Source§

impl<'a> Eq for Command<'a>

Source§

impl<'a> StructuralPartialEq for Command<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Command<'a>

§

impl<'a> RefUnwindSafe for Command<'a>

§

impl<'a> Send for Command<'a>

§

impl<'a> Sync for Command<'a>

§

impl<'a> Unpin for Command<'a>

§

impl<'a> UnsafeUnpin for Command<'a>

§

impl<'a> UnwindSafe for Command<'a>

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
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.