pub struct SquareSpinner<'a> { /* private fields */ }Expand description
A rotating square braille-arc spinner.
A comet-like arc of braille dots travels around the perimeter of a square. Supports filled or empty center modes and clockwise/counter-clockwise directions.
§Quick start
use ratatui::style::Color;
use tui_spinner::{Centre, SquareSpinner, Spin};
let spinner = SquareSpinner::new(42)
.size(3)
.arc_color(Color::Cyan)
.dim_color(Color::DarkGray)
.centre(Centre::Filled);Implementations§
Source§impl<'a> SquareSpinner<'a>
impl<'a> SquareSpinner<'a>
Sourcepub fn new(tick: u64) -> Self
pub fn new(tick: u64) -> Self
Creates a new SquareSpinner with defaults: size 2, clockwise spin,
white arc, dark-gray dim, filled centre, 1 tick per step.
§Examples
use tui_spinner::SquareSpinner;
let spinner = SquareSpinner::new(42);Sourcepub fn size(self, size: usize) -> Self
pub fn size(self, size: usize) -> Self
Sets the arc thickness / square size (default: 2, range: 2–8).
Larger values produce a bigger square with a thicker arc.
§Examples
use tui_spinner::SquareSpinner;
let large = SquareSpinner::new(0).size(4);Sourcepub const fn spin(self, spin: Spin) -> Self
pub const fn spin(self, spin: Spin) -> Self
Sets the spin direction (default: Spin::Clockwise).
§Examples
use tui_spinner::{SquareSpinner, Spin};
let ccw = SquareSpinner::new(0).spin(Spin::CounterClockwise);Sourcepub const fn centre(self, centre: Centre) -> Self
pub const fn centre(self, centre: Centre) -> Self
Controls whether the centre is filled or empty (default: Centre::Filled).
§Examples
use tui_spinner::{Centre, SquareSpinner};
let hollow = SquareSpinner::new(0).centre(Centre::Empty);Sourcepub const fn arc_color(self, color: Color) -> Self
pub const fn arc_color(self, color: Color) -> Self
Sets the colour of the rotating bright arc (default: Color::White).
§Examples
use ratatui::style::Color;
use tui_spinner::SquareSpinner;
let spinner = SquareSpinner::new(0).arc_color(Color::Cyan);Sourcepub const fn dim_color(self, color: Color) -> Self
pub const fn dim_color(self, color: Color) -> Self
Sets the colour of the filled centre region (default: Color::DarkGray).
Only visible when Centre::Filled is active.
§Examples
use ratatui::style::Color;
use tui_spinner::SquareSpinner;
let spinner = SquareSpinner::new(0).dim_color(Color::DarkGray);Sourcepub fn ticks_per_step(self, n: u64) -> Self
pub fn ticks_per_step(self, n: u64) -> Self
Sets how many ticks each arc position is held (default: 1, higher = slower).
§Examples
use tui_spinner::SquareSpinner;
let slow = SquareSpinner::new(0).ticks_per_step(3);Sourcepub fn style<S: Into<Style>>(self, style: S) -> Self
pub fn style<S: Into<Style>>(self, style: S) -> Self
Sets the base style applied to the widget area.
Trait Implementations§
Source§impl<'a> Clone for SquareSpinner<'a>
impl<'a> Clone for SquareSpinner<'a>
Source§fn clone(&self) -> SquareSpinner<'a>
fn clone(&self) -> SquareSpinner<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for SquareSpinner<'a>
impl<'a> Debug for SquareSpinner<'a>
Source§impl Styled for SquareSpinner<'_>
impl Styled for SquareSpinner<'_>
Source§impl Widget for &SquareSpinner<'_>
impl Widget for &SquareSpinner<'_>
Auto Trait Implementations§
impl<'a> Freeze for SquareSpinner<'a>
impl<'a> RefUnwindSafe for SquareSpinner<'a>
impl<'a> Send for SquareSpinner<'a>
impl<'a> Sync for SquareSpinner<'a>
impl<'a> Unpin for SquareSpinner<'a>
impl<'a> UnsafeUnpin for SquareSpinner<'a>
impl<'a> UnwindSafe for SquareSpinner<'a>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T, U> Stylize<'_, T> for Uwhere
U: Styled<Item = T>,
impl<T, U> Stylize<'_, T> for Uwhere
U: Styled<Item = T>,
fn bg<C>(self, color: C) -> T
fn fg<C>(self, color: C) -> T
fn add_modifier(self, modifier: Modifier) -> T
fn remove_modifier(self, modifier: Modifier) -> T
fn reset(self) -> T
Source§fn on_magenta(self) -> T
fn on_magenta(self) -> T
magenta.Source§fn on_dark_gray(self) -> T
fn on_dark_gray(self) -> T
dark_gray.Source§fn on_light_red(self) -> T
fn on_light_red(self) -> T
light_red.Source§fn light_green(self) -> T
fn light_green(self) -> T
light_green.Source§fn on_light_green(self) -> T
fn on_light_green(self) -> T
light_green.Source§fn light_yellow(self) -> T
fn light_yellow(self) -> T
light_yellow.Source§fn on_light_yellow(self) -> T
fn on_light_yellow(self) -> T
light_yellow.Source§fn light_blue(self) -> T
fn light_blue(self) -> T
light_blue.Source§fn on_light_blue(self) -> T
fn on_light_blue(self) -> T
light_blue.Source§fn light_magenta(self) -> T
fn light_magenta(self) -> T
light_magenta.Source§fn on_light_magenta(self) -> T
fn on_light_magenta(self) -> T
light_magenta.Source§fn light_cyan(self) -> T
fn light_cyan(self) -> T
light_cyan.Source§fn on_light_cyan(self) -> T
fn on_light_cyan(self) -> T
light_cyan.Source§fn not_italic(self) -> T
fn not_italic(self) -> T
italic modifier.Source§fn underlined(self) -> T
fn underlined(self) -> T
underlined modifier.Source§fn not_underlined(self) -> T
fn not_underlined(self) -> T
underlined modifier.Source§fn slow_blink(self) -> T
fn slow_blink(self) -> T
slow_blink modifier.Source§fn not_slow_blink(self) -> T
fn not_slow_blink(self) -> T
slow_blink modifier.Source§fn rapid_blink(self) -> T
fn rapid_blink(self) -> T
rapid_blink modifier.Source§fn not_rapid_blink(self) -> T
fn not_rapid_blink(self) -> T
rapid_blink modifier.Source§fn not_reversed(self) -> T
fn not_reversed(self) -> T
reversed modifier.hidden modifier.hidden modifier.Source§fn crossed_out(self) -> T
fn crossed_out(self) -> T
crossed_out modifier.Source§fn not_crossed_out(self) -> T
fn not_crossed_out(self) -> T
crossed_out modifier.