fast_stack

Macro fast_stack 

Source
macro_rules! fast_stack {
    ( $ty:ty,
      ($first:expr $(, $rest:expr)* $(,)?),
      $size:expr,
      $stack_ident:ident,
      $body:block
    ) => { ... };
}
Expand description

Creates a stack- or heap-allocated stack based on runtime size.

This macro chooses between StackStack<T, N> (stack-allocated) and HeapStack<T> (heap-allocated) depending on the provided size and threshold values.

ยงUsage

fast_stack!( u32, // type (64, 128, 256), // thresholds size, // runtime size stack, // variable name { stack.push(42); } );

  • Falls back to HeapStack<T>::new_with_capacity(size) if size exceeds thresholds.