Skip to main content

State

Struct State 

Source
pub struct State { /* private fields */ }
Expand description

Session choices tracked by Program for save and restore.

The values record requests staged through Program, including preferences adopted after discovery. They describe the state restored after a shell handoff, even while the program is paused. They do not confirm terminal acceptance or successful output after an I/O error. Direct writes and changes through screen_mut are outside this record.

Capabilities holds terminal replies separately. Startup configuration stays in ProgramOptions. Read the current choices through Program::state, or clone them for an owned snapshot. Neither operation sends queries or waits for replies.

Implementations§

Source§

impl State

Source

pub fn cursor_style(&self) -> CursorStyle

Cursor appearance selected through Program, or the terminal default.

Source

pub fn cursor_color(&self) -> Option<Color>

Requested cursor color override, or the terminal default.

Source

pub fn cursor_visible(&self) -> bool

Requested hardware cursor visibility. Initially true.

Source

pub fn alt_screen(&self) -> bool

Whether the alternate screen buffer is selected.

Source

pub fn mouse(&self) -> Option<Option<MouseTracking>>

Selected mouse policy. None means no choice; Some(None) disables tracking. Some(Some(empty())) requests basic button tracking.

Source

pub fn kitty_keyboard(&self) -> Option<KittyKeyboardFlags>

Selected Kitty flags. None means no choice; Some(empty()) explicitly disables all enhancements. The selection follows buffer transitions.

Source

pub fn modify_other_keys(&self) -> Option<ModifyOtherKeysMode>

Selected modifyOtherKeys mode, including an explicit disabled choice. None means the application has made no choice.

Source

pub fn mode(&self, mode: Mode) -> Option<bool>

Selected value of a tracked boolean mode.

None means no choice was made through Program, or the mode is outside this record. Some(false) is an explicit reset. Supported modes are alternate screen (1049), cursor visibility (25), bracketed paste (2004), focus (1004), color scheme (2031), visibility reports (2033), in-band resize (2048), Unicode core (2027), and Backarrow (67).

This records application choices and adopted preferences, independently of the last report in Capabilities::mode.

Source

pub fn foreground_color(&self) -> Option<Color>

Requested default foreground override.

Source

pub fn background_color(&self) -> Option<Color>

Requested default background override.

Source

pub fn palette(&self) -> &BTreeMap<u8, Color>

Requested indexed palette overrides.

Source

pub fn window_title(&self) -> Option<&str>

Requested window title override.

Source

pub fn icon_name(&self) -> Option<&str>

Requested icon name override.

Source

pub fn pointer_shape(&self) -> Option<&str>

Requested pointer shape override.

Source

pub fn progress(&self) -> Option<ProgressState>

Requested progress indicator.

Trait Implementations§

Source§

impl Clone for State

Source§

fn clone(&self) -> Self

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 Debug for State

Source§

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

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

impl Default for State

Source§

fn default() -> Self

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

impl Eq for State

Source§

impl PartialEq for State

Source§

fn eq(&self, other: &Self) -> 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 State

Auto Trait Implementations§

§

impl Freeze for State

§

impl RefUnwindSafe for State

§

impl Send for State

§

impl Sync for State

§

impl Unpin for State

§

impl UnsafeUnpin for State

§

impl UnwindSafe for State

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> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.