ListTrace holds the steps of a linked list, a stack or a queue. Each ListStep has the
items in order, each with an id that stays with it from step to step (so the figures can
move, add and remove items smoothly), the links when they are not simply each item to the
next, the highlighted items, a found item, named pointers and a note.
ListTrace::record(&values) starts a ListRecorder; every operation adds the steps that
show it, and finish gives the trace:
- stack:
push,pop(the item lights up, then leaves),peek; - queue:
enqueue,dequeue,peek_front; - linked list:
insert(index, value)andremove(index)walk acurpointer to the node before,find(value)walks until it finds the value, andreversewalksprev,curandnextalong while each link turns back, then puts the nodes in their new order; notereplaces the note of the last step.
Gallery scene: ListTrace shows an insert, a removal and a reversal.

ListTrace 12.5 suse fframes_kit::prelude::*;
let list = ListTrace::record(&[3, 8, 1]).insert(2, 5).remove(0).reverse().finish();assert_eq!(list.result(), ["1", "5", "8"]);
let stack = ListTrace::record(&[4]).push(7).pop().finish();assert_eq!(stack.result(), ["4"]);
fn draw<'a>(ui: &mut Ui<'a, '_, '_>, trace: &'a ListTrace) -> Svgr<'a> { ui.show(LinkedList { trace: Some(trace), step_time: 0.7, ..ui.defaults() })}