Function n_elements_for_stack

Source
pub const fn n_elements_for_stack<T>() -> usize
Expand description

The maximun number of elements that can be stored in the stack for the vector, without incrementing it’s size

This means, that n_elements_for_stack for T returns the max number of elements, so that when switching to a heap allocated buffer, no stack size is wasted

§Examples

use tiny_vec::n_elements_for_stack;

assert_eq!(n_elements_for_stack::<u8>(), 16);
assert_eq!(n_elements_for_stack::<u16>(), 8);
assert_eq!(n_elements_for_stack::<i32>(), 4);