Skip to main content

Kitty

Struct Kitty 

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

The kitty presenter. Holds wire state only: which images were sent and which placement pairs are live. Scene ids throughout; the wrap into protocol ids happens once, at each encode.

Implementations§

Source§

impl Kitty

Source

pub fn new() -> Self

A fresh presenter for a fresh terminal session.

Source

pub fn for_multiplexer(self, space: IdSpace) -> Self

Place every image relative to a placeholder anchor under a multiplexer, which then hides them with their pane. We also leave out the synchronized-output wrapper there, because we send terminal queries between batches and a terminal holds its answers until a synchronized update ends. Every image id goes into space, so programs sharing the terminal keep their images apart.

Source

pub fn banded(self, banded: bool) -> Self

Send big images as a blank image plus bands of rows, so a multiplexer can pace between them. The bands are frame edits, so only a terminal that stores animation frames takes them.

Source

pub fn reset<W: Sink>(&mut self, out: &mut W) -> Result<()>

Free every image this presenter sent and forget them all, as for a new window. Other programs on the terminal keep theirs.

Source

pub fn render<W: Sink>( &mut self, out: &mut W, delta: &PlacementDelta, images: &Images<'_>, ) -> Result<usize>

Write delta as kitty graphics frames and return the byte count, the input of the frame budget pacing. The whole exchange sits in DEC 2026 synchronized output and leaves in one write, so a terminal never shows half of it. An empty diff writes nothing.

Added placements place their image, transmitting it once if this presenter has not sent it yet; an added placement whose image is missing from images is skipped, because its pixels are not on the wire. Moves re-place their pair at the new origin. Removed pairs delete themselves, and an image whose last placement left is deleted whole.

Trait Implementations§

Source§

impl Debug for Kitty

Source§

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

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

impl Default for Kitty

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl Forget for Kitty

§

impl Freeze for Kitty

§

impl Move for Kitty

§

impl RefUnwindSafe for Kitty

§

impl Send for Kitty

§

impl Sync for Kitty

§

impl Unpin for Kitty

§

impl UnsafeUnpin for Kitty

§

impl UnwindSafe for Kitty

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 = !

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.