StackArrayString

Type Alias StackArrayString 

Source
pub type StackArrayString<const N: usize, const CAP: usize> = StackVec<StackString<N>, CAP>;
Expand description

A stack-allocated array of small strings.

This is a convenience alias for StackVec<StackString<N>, CAP>, useful when you need a fixed-capacity collection of short strings.

§Examples

use stack_collections::StackArrayString;

let mut arr: StackArrayString<16, 4> = StackArrayString::new();

arr.push("hello".try_into().unwrap());
arr.push("world".try_into().unwrap());

assert_eq!(arr.len(), 2);
assert_eq!(arr.capacity(), 4);
assert_eq!(arr[0].capacity(), 16);
assert_eq!(arr[0].as_str(), "hello");
assert_eq!(arr[1].as_str(), "world");

Aliased Type§

pub struct StackArrayString<const N: usize, const CAP: usize> { /* private fields */ }