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: usizeCurrent animation frame index. Increment to animate.
Implementations§
Source§impl SpinnerState
impl SpinnerState
Sourcepub fn tick(&mut self)
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§
Auto Trait Implementations§
impl Freeze for SpinnerState
impl RefUnwindSafe for SpinnerState
impl Send for SpinnerState
impl Sync for SpinnerState
impl Unpin for SpinnerState
impl UnsafeUnpin for SpinnerState
impl UnwindSafe for SpinnerState
Blanket Implementations§
Source§impl<T, V> AddTo<DataChildren<T>> for Vwhere
V: Into<T>,
impl<T, V> AddTo<DataChildren<T>> for Vwhere
V: Into<T>,
Source§type Handle<'a> = DataHandle
where
T: 'a
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
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> 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
Mutably borrows from an owned value. Read more
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>
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 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>
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