Skip to main content

SpinnerState

Struct SpinnerState 

Source
pub struct SpinnerState {
    pub frame: usize,
}
Expand description

Internal state for a Spinner component.

Tracks the current animation frame. You typically don’t interact with this directly — the spinner’s lifecycle interval calls tick automatically. Access it via InlineRenderer::state_mut if you need manual control.

Fields§

§frame: usize

Current animation frame index. Increment to animate.

Implementations§

Source§

impl SpinnerState

Source

pub fn new() -> Self

Create initial spinner state at frame 0.

Source

pub fn tick(&mut self)

Advance the animation by one frame.

Examples found in repository?
examples/markdown_demo.rs (line 99)
91fn animate_spinner(
92    r: &mut InlineRenderer,
93    stdout: &mut impl Write,
94    id: eye_declare::NodeId,
95    duration: Duration,
96) -> io::Result<()> {
97    let start = Instant::now();
98    while start.elapsed() < duration {
99        r.state_mut::<Spinner>(id).tick();
100        flush(r, stdout)?;
101        thread::sleep(Duration::from_millis(80));
102    }
103    Ok(())
104}

Trait Implementations§

Source§

impl Default for SpinnerState

Source§

fn default() -> Self

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

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T, V> AddTo<DataChildren<T>> for V
where V: Into<T>,

Source§

type Handle<'a> = DataHandle where T: 'a

Handle returned after adding. Supports .key() / .width() chaining.
Source§

fn add_to(self, collector: &mut DataChildren<T>) -> DataHandle

Add this value to the collector, returning a handle for chaining .key() and .width().
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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