1 unstable release

0.1.0 Nov 13, 2019

#771 in Memory management

37 downloads per month

MIT license

10KB
158 lines

StackList

This library defines a no-std stack-based linked list requiring no heap allocation, yet without any size limit (apart from the stack size).


lib.rs:

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 Node as a member like you would a LinkedList.
  • 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).

No runtime deps