pub struct Spinner;Expand description
An indeterminate loading indicator component.
Spinner displays an animated indicator to show ongoing activity.
Unlike ProgressBar, it does not show specific
progress - just that something is happening.
§Animation
The spinner advances one frame each time it receives a Tick message.
Your application should send Tick messages at regular intervals
(typically every 80-100ms) to create smooth animation.
§Styles
Several built-in styles are available:
Dots: Braille dots (⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏) - defaultLine: Classic ASCII (|/-\)Circle: Quarter circles (◐◓◑◒)Bounce: Bouncing dot (⠁⠂⠄⠂)Custom: Your own character sequence
§Example
use envision::component::{Spinner, SpinnerMessage, SpinnerState, Component};
let mut state = SpinnerState::with_label("Processing...");
// In your app's update function, forward timer ticks:
Spinner::update(&mut state, SpinnerMessage::Tick);
// Stop when done:
Spinner::update(&mut state, SpinnerMessage::Stop);Trait Implementations§
Source§impl Component for Spinner
impl Component for Spinner
Source§type State = SpinnerState
type State = SpinnerState
The component’s internal state type. Read more
Source§type Message = SpinnerMessage
type Message = SpinnerMessage
Messages this component can receive. Read more
Source§fn update(state: &mut Self::State, msg: Self::Message) -> Option<Self::Output>
fn update(state: &mut Self::State, msg: Self::Message) -> Option<Self::Output>
Update component state based on a message. Read more
Source§fn view(
state: &Self::State,
frame: &mut Frame<'_>,
area: Rect,
theme: &Theme,
_ctx: &ViewContext,
)
fn view( state: &Self::State, frame: &mut Frame<'_>, area: Rect, theme: &Theme, _ctx: &ViewContext, )
Render the component to the given area. Read more
Source§fn traced_view(
state: &Self::State,
frame: &mut Frame<'_>,
area: Rect,
theme: &Theme,
ctx: &ViewContext,
)
fn traced_view( state: &Self::State, frame: &mut Frame<'_>, area: Rect, theme: &Theme, ctx: &ViewContext, )
Renders the component with optional tracing instrumentation. Read more
Source§impl Disableable for Spinner
impl Disableable for Spinner
Source§fn is_disabled(state: &Self::State) -> bool
fn is_disabled(state: &Self::State) -> bool
Returns true if this component is currently disabled.
Source§fn set_disabled(state: &mut Self::State, disabled: bool)
fn set_disabled(state: &mut Self::State, disabled: bool)
Sets the disabled state of this component.
Auto Trait Implementations§
impl Freeze for Spinner
impl RefUnwindSafe for Spinner
impl Send for Spinner
impl Sync for Spinner
impl Unpin for Spinner
impl UnsafeUnpin for Spinner
impl UnwindSafe for Spinner
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
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