This library implements a heapless linked list by keeping each element on the stack.
The primary purpose is to efficiently keep a context when traversing trees recursively.
Compared to a traditional linked list, this has a few drawbacks:
- Not "self-contained": you cannot easily store a
Nodeas a member like you would a
- Many methods use recursion and lead to increase stack memory usage (because of function frames).
The main advantage is that it does not need any heap allocation, and can grow to arbitrary sizes (only limited by your stack size).
Convenient macro to define a stack list from a slice literal.
A stack-based linked list.