pub struct PetState {
pub enabled: bool,
pub path: String,
pub x: u16,
pub y: u16,
pub width_cells: u16,
pub speed: u16,
pub load_error: Option<String>,
pub image_id: u32,
/* private fields */
}Fields§
§enabled: bool§path: String§x: u16Cell column / row (top-left of image).
y: u16§width_cells: u16Display width in terminal cells (height scales with aspect).
speed: u16Playback speed percent (25..=400). 100 = native GIF timing.
load_error: Option<String>§image_id: u32Kitty image id (stable so we replace rather than leak).
Implementations§
Source§impl PetState
impl PetState
pub fn new() -> Self
pub fn has_frames(&self) -> bool
pub fn frame_count(&self) -> usize
pub fn frame_idx(&self) -> usize
Sourcepub fn clamp_speed(s: u16) -> u16
pub fn clamp_speed(s: u16) -> u16
Clamp speed to a sensible range.
Sourcepub fn invalidate_display_cache(&mut self)
pub fn invalidate_display_cache(&mut self)
Invalidate display cache (call when width_cells changes).
Sourcepub fn ensure_display_cache(&mut self, cell_px: u32)
pub fn ensure_display_cache(&mut self, cell_px: u32)
Build / refresh pre-scaled + base64 frames for the Kitty paint path.
Sourcepub fn effective_delay(&self) -> Duration
pub fn effective_delay(&self) -> Duration
Effective delay for the current frame after speed scaling.
Sourcepub fn tick(&mut self) -> bool
pub fn tick(&mut self) -> bool
Advance animation clock; returns true if the visible frame changed. Uses catch-up so heavy frames don’t permanently lag.
pub fn current_frame(&self) -> Option<&PetFrame>
pub fn current_display(&self) -> Option<&PetDisplayFrame>
Sourcepub fn display_px(&self, cell_px: u32) -> (u32, u32)
pub fn display_px(&self, cell_px: u32) -> (u32, u32)
Pixel size when fitting into width_cells × ~cell_px.
Sourcepub fn screen_xy(&self, screen_w: u16, screen_h: u16) -> (u16, u16)
pub fn screen_xy(&self, screen_w: u16, screen_h: u16) -> (u16, u16)
Clamp for painting only — never mutates saved x/y.
Startup used to clamp into the default 80×24 before the first draw, permanently wiping a bottom-right config until the next Settings save.
Sourcepub fn speed_label(speed: u16) -> String
pub fn speed_label(speed: u16) -> String
Human label for speed (e.g. 1.0×).
Sourcepub fn speed_slider(speed: u16, width: usize) -> String
pub fn speed_slider(speed: u16, width: usize) -> String
ASCII slider for settings (10 segments).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PetState
impl RefUnwindSafe for PetState
impl Send for PetState
impl Sync for PetState
impl Unpin for PetState
impl UnsafeUnpin for PetState
impl UnwindSafe for PetState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more