Library guide · API index and notation
This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.
import "std/fmt_alloc"
Names used in signatures
Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.
| Alias | Package | Source file |
|---|---|---|
bytes_alloc |
std/bytes_alloc |
fmt_alloc.dodo |
error |
alloc/error |
fmt_alloc.dodo |
fmt |
std/fmt |
fmt_alloc.dodo |
io |
std/io |
fmt_alloc.dodo |
io_alloc |
std/io_alloc |
fmt_alloc.dodo |
text |
std/text |
fmt_alloc.dodo |
text_alloc |
std/text_alloc |
fmt_alloc.dodo |
Error
Enum · Source
pub enum Error {
Allocation(error.AllocError), Format(io.Error), Text(text.Error)
}
string
Function · Source
Consume an explicitly allocated buffer, clear its previous bytes, and format a value into a new validated UTF-8 string. Capacity may grow up to the buffer’s limit. Failure destroys the buffer, releases its allocation, and preserves the error (including formatter progress). Custom formatters may emit arbitrary bytes; malformed UTF-8 is rejected rather than entering String’s invariant.
pub fn string<A, T>(buffer: bytes_alloc.Buffer<A>, value: &T) -> text_alloc.String<A>!Error from(buffer)
allocate
Function · Source
SAFETY: A must honor std/bytes_alloc.new’s allocation contract. Prefer the safe std/arena_bytes or std/pool_bytes constructors followed by string above.
pub unsafe fn allocate<A, T>(allocator: &mut A, capacity: usize, limit: usize, value: &T) -> text_alloc.String<A>!Error from(allocator)
Requires an unsafe context. Follow the source safety preconditions and the linked guide before calling this API.