Skip to main content

Snapshot

Struct Snapshot 

Source
pub struct Snapshot<'alloc, 's>(/* private fields */);
Expand description

A snapshot of the render state after an update.

This struct exists to guard data accessed from the render state from being accidentally modified after an update. If you find yourself unable to update the render state due to borrow checker errors, make sure to drop the active snapshot (and data that depends on it) before updating.

Implementations§

Source§

impl Snapshot<'_, '_>

Source

pub fn dirty(&self) -> Result<Dirty>

Get the current dirty state.

Source

pub fn cols(&self) -> Result<u16>

Get the viewport width.

Source

pub fn rows(&self) -> Result<u16>

Get the viewport height.

Source

pub fn cursor_color(&self) -> Result<Option<RgbColor>>

Get the cursor color that may have been explicitly set by the terminal state.

Source

pub fn cursor_visible(&self) -> Result<bool>

Whether the cursor is currently visible based on terminal modes.

Source

pub fn cursor_blinking(&self) -> Result<bool>

Whether the cursor is currently blinking based on terminal modes.

Source

pub fn cursor_password_input(&self) -> Result<bool>

Whether the cursor is at a password input field.

Source

pub fn cursor_visual_style(&self) -> Result<CursorVisualStyle>

Get the visual style of the cursor.

Source

pub fn cursor_viewport(&self) -> Result<Option<CursorViewport>>

Get the relative position of the cursor and other information if it is currently visible within the viewport.

Source

pub fn colors(&self) -> Result<Colors>

Get the current color information from a render state.

Source

pub fn set_dirty(&self, dirty: Dirty) -> Result<()>

Set dirty state.

Trait Implementations§

Source§

impl<'alloc, 's> Debug for Snapshot<'alloc, 's>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'alloc, 's> Freeze for Snapshot<'alloc, 's>

§

impl<'alloc, 's> RefUnwindSafe for Snapshot<'alloc, 's>

§

impl<'alloc, 's> !Send for Snapshot<'alloc, 's>

§

impl<'alloc, 's> !Sync for Snapshot<'alloc, 's>

§

impl<'alloc, 's> Unpin for Snapshot<'alloc, 's>

§

impl<'alloc, 's> UnsafeUnpin for Snapshot<'alloc, 's>

§

impl<'alloc, 's> !UnwindSafe for Snapshot<'alloc, 's>

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