zig
zig copied to clipboard
Implements std.PaddedArray as a companion to std.BoundedArray
This is a bare bones implementation of a padded array. These are similar to a sentinelled array, but the sentinel is only used for implicit length determination.
These kind of arrays are often used in C APIs inside of structs to store strings up to a length of N
. Thus, a padded array alias was exported from std.c.CharArray
, so people can easily interact with C APIs that use this kind of strings.
If wanted, i can add the usual container APIs that are also present in std.BoundedArray
, as long as they are useful. Stuff like .resize()
doesn't make much sense on this kind of type, but functions like .append()
or a .writer()
could definitly be useful.