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/text_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 |
|---|---|---|
arena |
alloc/arena |
text_alloc.dodo |
bytes_alloc |
std/bytes_alloc |
text_alloc.dodo |
error |
alloc/error |
text_alloc.dodo |
mem |
core/mem |
text_alloc.dodo |
text |
std/text |
text_alloc.dodo |
Error
Enum · Source
pub enum Error {
Text(text.Error), Allocation(error.AllocError)
}
String
Struct · Source
Explicitly owned, growing UTF-8. The Buffer owns an exclusive borrow of its allocator; dropping String releases its buffer deterministically. Its private buffer cannot be mutated except through operations preserving UTF-8 validity.
pub struct String<A> {
// Private implementation fields omitted.
}
String.new
Function · Source
Takes ownership even on validation failure, releasing the supplied buffer.
pub fn new(buffer: bytes_alloc.Buffer<A>) -> String<A>!text.Error from(buffer)
String.len_bytes
Function · Source
pub fn len_bytes(&self) -> usize
String.capacity
Function · Source
pub fn capacity(&self) -> usize
String.limit
Function · Source
pub fn limit(&self) -> usize
String.as_text
Function · Source
pub fn as_text(&self) -> text.Text from(self)
String.reserve
Function · Source
pub fn reserve(&mut self, additional: usize) -> void!error.AllocError
String.append
Function · Source
pub fn append(&mut self, value: &text.Text) -> void!error.AllocError
String.append_str
Function · Source
pub fn append_str(&mut self, value: &str) -> void!error.AllocError
String.truncate
Function · Source
pub fn truncate(&mut self, length: usize) -> void!text.Error
String.push
Function · Source
pub fn push(&mut self, scalar: u32) -> void!Error
String.clear
Function · Source
pub fn clear(&mut self)
empty
Function · Source
Direct safe constructors for the concrete exclusive arena adapter. Prefer text_shared when several independently mutable owners share an allocator.
pub fn empty(allocator: &mut arena.Arena, limit: usize) -> String<arena.Arena>!error.AllocError from(allocator)
from_str
Function · Source
pub fn from_str(allocator: &mut arena.Arena, value: &str, limit: usize) -> String<arena.Arena>!error.AllocError from(allocator)
from_text
Function · Source
pub fn from_text(allocator: &mut arena.Arena, value: &text.Text, limit: usize) -> String<arena.Arena>!error.AllocError from(allocator)