glitzer/spinner

Types

Frames

opaque
pub opaque type Frames
pub opaque type SpinnerStyle

State

opaque

Contains everything that might get changed during runtime.

pub opaque type State

Functions

pub fn bar_left_right_spinner() -> SpinnerStyle

A spinner that goes from left to right and back.

pub fn bar_up_down_spinner() -> SpinnerStyle

A spinner with a bar that goes up and down.

pub fn default_spinner() -> SpinnerStyle

The default spinner.

pub fn finish(spinner s: SpinnerStyle) -> SpinnerStyle

Finish a spinner. If it was countinously ticking, the ticking will be stopped. The line will be cleared and the finish text will be printed if the spinner had some.

pub fn frames_from_list(frames frames: List(String)) -> Frames

Convert a given list of String to Frames.

pub fn new_spinner(frames f: Frames) -> SpinnerStyle

Create a new spinner from Frames with a 100ms tick rate.

pub fn prideful_spinner() -> SpinnerStyle

A very colorful spinner with the colors from the progress pride flag :3 Note that this spinner has a tick rate of 200 instead of 100 to not flash to fast.

pub fn print_spinner(spinner s: SpinnerStyle) -> Nil

Print the spinner. This is useful if you need/want manual control over your spinner ticks and prints.

pub fn pulsating_spinner() -> SpinnerStyle

A spinner that pulsates.

pub fn spin(spinner s: SpinnerStyle) -> SpinnerStyle

Continuously tick and print the spinner. Note that this does not update the tick value of your spinner reference!

Example:
import glitzer/spinner

fn example() {
  spinner.default_spinner()
  |> spinner.spin
}
pub fn spinning_spinner() -> SpinnerStyle

A spinner that actually spins.

pub fn tick(spinner s: SpinnerStyle) -> SpinnerStyle

Progress the spinner by one.

pub fn tick_by(spinner s: SpinnerStyle, i i: Int) -> SpinnerStyle

Progress the spinner by i.

pub fn with_finish_text(
  spinner s: SpinnerStyle,
  text t: String,
) -> SpinnerStyle

Set the spinners finish text.

pub fn with_left_text(
  spinner s: SpinnerStyle,
  text t: String,
) -> SpinnerStyle

Set the left text of the spinner.

pub fn with_right_text(
  spinner s: SpinnerStyle,
  text t: String,
) -> SpinnerStyle

Set the right text of the spinner.

pub fn with_tick_rate(
  spinner s: SpinnerStyle,
  ms ms: Int,
) -> SpinnerStyle

Set the spinners tick rate in milliseconds.

Search Document