create static method
Creates a new StructString
with the given capacity.
Allocates memory for the string and initializes its fields.
@param capacity The capacity of the string.
@return A pointer to the newly created StructString
.
Implementation
static Pointer<StructString> create(int capacity) {
final ptr = calloc<StructString>();
ptr.ref.data = calloc<Uint8>(capacity);
ptr.ref.capacity = capacity;
ptr.ref.length = 0;
return ptr;
}