StringBuilder
pub type StringBuilder = { ptr: ref u8, len: i64, cap: i64 }The almighty str.String builder
Fields
| Name | Type |
|---|---|
ptr | ref u8 |
len | i64 |
cap | i64 |
fn ensure_cap(ptr: ref void, needed: i64) void = trust { ... }Ensure capacity (private helper)
pub type StringBuilder = { ptr: ref u8, len: i64, cap: i64 }The almighty str.String builder
| Name | Type |
|---|---|
ptr | ref u8 |
len | i64 |
cap | i64 |
pub fn (StringBuilder) new() StringBuilderCreate a new empty StringBuilder
pub fn (StringBuilder) append(sb: StringBuilder, v: str.StringView) void = trust { ... }Append a borrowed string view to the builder.
pub fn (StringBuilder) append_string(sb: StringBuilder, s: str.String) void = trust { ... }Append an owned str.String to the builder.
pub fn (StringBuilder) append_cstr(sb: StringBuilder, cstr: ref u8) void = trust { ... }Append a C string to the builder
pub fn (StringBuilder) build(sb: StringBuilder) str.String = trust { ... }Build — returns a new heap-allocated str.String with the accumulated content
pub fn (StringBuilder) free(sb: StringBuilder) void = trust { ... }Free the StringBuilder's internal buffer and header
pub fn (StringBuilder) append_char(sb: StringBuilder, c: u8) void = trust { ... }Append a single byte character
pub fn (StringBuilder) clear(sb: StringBuilder) void = trust { ... }Clear the builder (reset length to 0, keep allocation)