Phosphor::SpinnerMock
Inherits Phosphor::MockWidget < Reference < Object
An animated spinner, for indicating in-progress work.
Generic and app-agnostic: no knowledge of AppState, Msg, or the
application theme. The Widget wrapper resolves theme → Style values
and sets them in Props before each render.
Owns no timer: it only advances state.frame_index in response to
Cmd::Tick. The consuming screen mounts a TickPort in on_mount;
the wrapping Widget translates each TickEvent it receives into a
Cmd::Tick for this mock's handle_cmd. See .claude/rules/async.md.
Constructors
Initialises the spinner with props and an optional state. Both
default, since every Props field has a sensible default of its own.
Instance methods
Responds to Cmd::Tick by advancing state.frame_index, wrapping at
props.frames.size. A no-op (returns CmdResult::None) if
props.frames is empty, to avoid dividing by zero. Any other command
also returns CmdResult::None.
Writes the current spinner frame into buf at frame.x, frame.y.
Does nothing if props.frames is empty — there's no glyph to draw.
Narrows the inherited state getter to SpinnerMock::WidgetState.
Safe: initialize only ever stores a WidgetState into the base
@state ivar.