Module imm/string
imm/string
Immutable, thread-safe UTF-8 string type.
Uses atomic reference counting for safe sharing across threads. All "modification" operations return a new string; the original is unchanged.
Types
String
atomic object
String
Immutable, thread-safe UTF-8 string.
Uses atomic RC — cheap to clone, safe to share across threads. No mutable operations. All "modification" methods return a new String.
Empty strings are zero-allocation (null pointer, zero length).
Fields
| Name | Type | Description |
|---|---|---|
_ptr | Option(*(u8)) | |
_len | usize | |
_capacity | usize |
Trait Implementations
impl(String, Dispose(...))
dispose : (fn(self: Self) -> unit)Returns: unit
impl(String, ...)
new : (String) fn() -> StringCreate a new empty string (zero allocation).
Returns: String
from : (String) fn(s : str) -> Stringfrom_string : (String) fn(s : String) -> Stringbytes_len : (String) fn(self : String) -> usizelen : (String) fn(self : String) -> usizeNumber of Unicode characters (runes) in the string.
Parameters
| Name | Type | Notes |
|---|---|---|
self | String |
Returns: usize
is_empty : (String) fn(self : String) -> boolas_str : (String) fn(self : String) -> strGet a str view of the string's bytes (zero-copy borrow).
Parameters
| Name | Type | Notes |
|---|---|---|
self | String |
Returns: str
byte_at : (String) fn(self : String, index : usize) -> Option(u8)concat : (String) fn(self : String, other : String) -> Stringslice : (String) fn(self : String, start : usize, end : usize) -> Stringstarts_with : (String) fn(self : String, prefix : String) -> boolends_with : (String) fn(self : String, suffix : String) -> boolindex_of : (String) fn(self : String, needle : String, from_index : usize) -> Option(usize)contains : (String) fn(self : String, needle : String) -> boolsplit : (String) fn(self : String, sep : String) -> List(String)_is_whitespace : (String) fn(b : u8) -> boolCheck if a byte is ASCII whitespace.
Parameters
| Name | Type | Notes |
|---|---|---|
b | u8 |
Returns: bool
trim : (String) fn(self : String) -> Stringtrim_start : (String) fn(self : String) -> Stringtrim_end : (String) fn(self : String) -> Stringto_lowercase : (String) fn(self : String) -> Stringto_uppercase : (String) fn(self : String) -> Stringreplace : (String) fn(self : String, search : String, replacement : String) -> Stringreplace_all : (String) fn(self : String, search : String, replacement : String) -> Stringrepeat : (String) fn(self : String, n : usize) -> String_decode_rune_at : (String) fn(self : String, byte_index : usize) -> Option(rune)impl(String, Eq(String)(...))
impl(String, ...)
eq_str : (String) fn(self : String, other : str) -> boolimpl(String, Ord(String)(...))
impl(String, Hash(...))
impl(String, ToString(...))
to_string : (fn(self: *(Self)) -> std_string.String)Returns: std_string.String