stdlib/coreView source ↗
core
245 items · generated by scribe fromstdlib/core.fd· synced 2026-11-15
Contents
- println (function)
- assert (function)
- assert_msg (function)
- assert_eq (function)
- assert_eq_msg (function)
- assert_ne (function)
- assert_ne_msg (function)
- panic (function)
- Option (enum)
- (impl)
- Result (enum)
- (impl)
- (impl)
- max (function)
- min (function)
- abs (function)
- clamp (function)
- create_allocator (function)
- allocator_alloc (function)
- allocator_free (function)
- allocator_bytes_used (function)
- Iterator (trait)
- Error (trait)
- Vec_new (function)
- Vec_new_sized (function)
- Vec_new_typed (function)
- vec_buf_free (function)
- vec_box_free (function)
- Vec_filled_typed (function)
- vec_elem_drop (function)
- vec_elem_dup (function)
- P_TID_BOX: (const)
- Vec_push_mem (function)
- Vec_set_mem (function)
- Vec_insert_mem (function)
- __p_mem_dup (function)
- __p_mem_drop (function)
- __p_elem_drop (function)
- __p_elem_dup (function)
- read_file (function)
- env_var (function)
- arg_at (function)
- read_line (function)
- read_stdin (function)
- p_zero_words (function)
- p_copy_words (function)
- p_mem_copy (function)
- vec_sz_push (function)
- vec_sz_get (function)
- vec_sz_set (function)
- vec_sz_pop (function)
- Vec_drop (function)
- Vec_init_typed (function)
- Vec_drop_inplace (function)
- vec_last_owner (function)
- Vec_drop_strs (function)
- Vec_drop_vecs (function)
- HashMap_drop (function)
- Vec_share (function)
- Vec_share_deep (function)
- vec_own (function)
- Str_drop (function)
- Str_dup (function)
- Vec_push (function)
- Vec_pop (function)
- Vec_len (function)
- Vec_is_empty (function)
- Vec_elem_addr (function)
- Vec_get (function)
- Vec_eq_words (function)
- Vec_eq_strs (function)
- Vec_set (function)
- Vec_clear (function)
- Vec_capacity (function)
- Vec_contains (function)
- Vec_first (function)
- Vec_last (function)
- Vec_truncate (function)
- Vec_reverse (function)
- vec_raw_reverse (function)
- Vec_extend (function)
- vec_raw_extend (function)
- Vec_insert (function)
- vec_raw_insert (function)
- Vec_remove (function)
- vec_raw_remove (function)
- Vec_clone (function)
- Vec_to_str (function)
- Vec_sort (function)
- vec_raw_sort (function)
- p_str_equal (function)
- HashMap_new (function)
- HashMap_new_typed (function)
- HashMap_insert_i (function)
- HashMap_get_i (function)
- HashMap_contains_i (function)
- HashMap_remove_i (function)
- HashMap_get_or_i (function)
- HashMap_keys_i (function)
- HashMap_values_i (function)
- HashMap_share (function)
- map_own (function)
- HashMap_insert (function)
- HashMap_get (function)
- HashMap_contains (function)
- HashMap_remove (function)
- HashMap_len (function)
- HashMap_is_empty (function)
- HashMap_clear (function)
- HashMap_keys (function)
- HashMap_values (function)
- HashMap_clone (function)
- p_send_copy (function)
- p_str_send_copy (function)
- Vec_send_copy (function)
- HashMap_send_copy (function)
- HashMap_get_or (function)
- HashMap_to_str (function)
- p_str_from_ptr (function)
- p_str_cstr_len (function)
- p_str_adopt (function)
- p_str_take (function)
- p_str_hdr_len (function)
- p_str_append (function)
- p_str_alloc (function)
- p_str_buf (function)
- p_str_free (function)
- p_str_copy_n (function)
- String_from (function)
- String_len (function)
- String_is_empty (function)
- String_push_str (function)
- String_contains (function)
- String_starts_with (function)
- String_ends_with (function)
- String_trim (function)
- String_to_uppercase (function)
- String_to_lowercase (function)
- String_slice (function)
- String_slice_len (function)
- String_find (function)
- p_mem_find_byte (function)
- String_rfind (function)
- String_replace (function)
- p_bytes_eq (function)
- String_split (function)
- String_parse_int (function)
- String_char_at (function)
- p_str_concat_int (function)
- String_repeat (function)
- String_to_string (function)
- String_clone (function)
- String_bytes (function)
- StringBuilder (struct)
- StringBuilder (impl)
- String_byte_at (function)
- String_char_count (function)
- char_to_str (function)
- char_is_digit (function)
- char_is_alpha (function)
- char_is_whitespace (function)
- char_is_upper (function)
- char_is_lower (function)
- char_to_upper (function)
- char_to_lower (function)
- ByteBuffer (struct)
- ByteBuffer (impl)
- str_bytes (function)
- str_from_bytes (function)
- str_slice (function)
- str_slice_len (function)
- str_starts_with (function)
- str_ends_with (function)
- str_contains (function)
- str_find (function)
- str_rfind (function)
- str_trim_start (function)
- str_trim_end (function)
- str_trim (function)
- str_lines (function)
- str_trim_end_char (function)
- str_split (function)
- str_split_char (function)
- str_replace (function)
- str_clone (function)
- str_repeat (function)
- str_to_upper (function)
- str_to_lower (function)
- str_parse_int (function)
- str_parse_int_range (function)
- str_byte_at (function)
- str_len (function)
- str_is_empty (function)
- str_concat (function)
- str_compare (function)
- str_equal (function)
- int_to_str (function)
- u64_to_str (function)
- float_to_str (function)
- str_parse_float (function)
- byte_to_str (function)
println
pub fn println(s: str) -> void {Parameters:
s:str
Returns: void
Defined at line 13
assert
pub fn assert(cond: bool) -> void {Parameters:
cond:bool
Returns: void
Defined at line 19
assert_msg
pub fn assert_msg(cond: bool, msg: str) -> void {Parameters:
cond:boolmsg:str
Returns: void
Defined at line 27
assert_eq
pub fn assert_eq<T>(a: T, b: T) -> void {Parameters:
a:Tb:T
Returns: void
Defined at line 34
assert_eq_msg
pub fn assert_eq_msg<T>(a: T, b: T, msg: str) -> void {Parameters:
a:Tb:Tmsg:str
Returns: void
Defined at line 41
assert_ne
pub fn assert_ne<T>(a: T, b: T) -> void {Parameters:
a:Tb:T
Returns: void
Defined at line 48
assert_ne_msg
pub fn assert_ne_msg<T>(a: T, b: T, msg: str) -> void {Parameters:
a:Tb:Tmsg:str
Returns: void
Defined at line 55
panic
pub fn panic(msg: str) -> void {Parameters:
msg:str
Returns: void
Defined at line 62
Option
pub enum Option<T> {Variants:
pubSome
Defined at line 72
impl < T > Option {Defined at line 79
Result
pub enum Result<T, E> {Variants:
pubOk
Defined at line 185
impl < T, E > Result {Defined at line 189
impl < T > Option {Defined at line 340
max
pub fn max(a: i64, b: i64) -> i64 {Parameters:
a:i64b:i64
Returns: i64
Defined at line 356
min
pub fn min(a: i64, b: i64) -> i64 {Parameters:
a:i64b:i64
Returns: i64
Defined at line 363
abs
pub fn abs(n: i64) -> i64 {Parameters:
n:i64
Returns: i64
Defined at line 370
clamp
pub fn clamp(n: i64, lo: i64, hi: i64) -> i64 {Parameters:
n:i64lo:i64hi:i64
Returns: i64
Defined at line 377
create_allocator
pub fn create_allocator(name: str) -> Allocator {Parameters:
name:str
Returns: Allocator
Defined at line 396
allocator_alloc
pub fn allocator_alloc(alloc: & Allocator, size: i64) -> i64 {Parameters:
alloc:& Allocatorsize:i64
Returns: i64
Defined at line 400
allocator_free
pub fn allocator_free(alloc: & Allocator, ptr: i64) -> void {Parameters:
alloc:& Allocatorptr:i64
Returns: void
Defined at line 404
allocator_bytes_used
pub fn allocator_bytes_used(alloc: & Allocator) -> i64 {Parameters:
alloc:& Allocator
Returns: i64
Defined at line 408
Iterator
pub cap Iterator {Defined at line 418
Error
pub cap Error {Defined at line 427
Vec_new
pub fn Vec_new() -> i64 {Returns: i64
Defined at line 448
Vec_new_sized
An empty Vec whose elements are stored at code’s size (D14; the compiler calls it for a Vec
pub fn Vec_new_sized(code: i64) -> i64 {Parameters:
code:i64
Returns: i64
Defined at line 467
Vec_new_typed
An empty Vec of elements stored at code’s size that owns them as element type tid says (proposal 0004): 0 plain values, P_TID_STR, P_TID_VEC, P_TID_MAP, or a struct/enum type the compiler numbered.
pub fn Vec_new_typed(code: i64, tid: i64) -> i64 {Parameters:
code:i64tid:i64
Returns: i64
Defined at line 474
vec_buf_free
Free a Vec’s data buffer, made by vec_buf_alloc or not.
pub fn vec_buf_free(d: i64) {Parameters:
d:i64
Defined at line 537
vec_box_free
Free a share box, unless it is the room in front of data.
pub fn vec_box_free(bx: i64, data: i64) {Parameters:
bx:i64data:i64
Defined at line 553
Vec_filled_typed
Vec::filled(n, x): n elements, each x, stored at code’s size and owned as tid says (each element is one more owner of x; the caller keeps its own). The C backend replaces the body with a memset or a word loop (codegen_c.fd fast_core_vec_body).
pub fn Vec_filled_typed(n: i64, x: i64, code: i64, tid: i64) -> i64 {Parameters:
n:i64x:i64code:i64tid:i64
Returns: i64
Defined at line 564
vec_elem_drop
Drop one owner of an element of type tid (proposal 0004).
pub fn vec_elem_drop(tid: i64, e: i64) {Parameters:
tid:i64e:i64
Defined at line 619
vec_elem_dup
One more owner of an element of type tid: the element to store.
pub fn vec_elem_dup(tid: i64, e: i64) -> i64 {Parameters:
tid:i64e:i64
Returns: i64
Defined at line 643
P_TID_BOX:
pub const P_TID_BOX: i64 = 0x8000;Defined at line 669
Vec_push_mem
v.push(x) for a struct x of size bytes (the Vec takes what it holds over).
pub fn Vec_push_mem(v: i64, x: i64, size: i64, tid: i64) {Parameters:
v:i64x:i64size:i64tid:i64
Defined at line 829
Vec_set_mem
v.set(i, x) / v[i] = x for a struct x of size bytes.
pub fn Vec_set_mem(v: i64, idx: i64, x: i64, size: i64, tid: i64) {Parameters:
v:i64idx:i64x:i64size:i64tid:i64
Defined at line 839
Vec_insert_mem
v.insert(i, x) for a struct x of size bytes.
pub fn Vec_insert_mem(v: i64, idx: i64, x: i64, size: i64, tid: i64) {Parameters:
v:i64idx:i64x:i64size:i64tid:i64
Defined at line 849
__p_mem_dup
One more owner of what the struct or enum of type tid at p holds (its bytes were copied). The lowering writes the body.
pub fn __p_mem_dup(tid: i64, p: i64) {Parameters:
tid:i64p:i64
Defined at line 860
__p_mem_drop
Drop the owners held by the struct or enum of type tid (16 and up) at p, which stays allocated. The lowering writes the body.
pub fn __p_mem_drop(tid: i64, p: i64) {Parameters:
tid:i64p:i64
Defined at line 865
__p_elem_drop
Drop or copy an element of a struct or enum type the compiler numbered (16 and up). Core leaves these empty; the lowering writes their bodies from the program’s types.
pub fn __p_elem_drop(tid: i64, e: i64) {Parameters:
tid:i64e:i64
Defined at line 871
__p_elem_dup
pub fn __p_elem_dup(tid: i64, e: i64) -> i64 {Parameters:
tid:i64e:i64
Returns: i64
Defined at line 874
read_file
The contents of file path, or None when it cannot be read.
pub fn read_file(path: str) -> Option<str> {Parameters:
path:str
Returns: Option<str>
Defined at line 883
env_var
Environment variable name, or None when it is not set.
pub fn env_var(name: str) -> Option<str> {Parameters:
name:str
Returns: Option<str>
Defined at line 892
arg_at
Command-line argument i (0 is the program), or None past the last.
pub fn arg_at(i: i64) -> Option<str> {Parameters:
i:i64
Returns: Option<str>
Defined at line 901
read_line
The next line of standard input, or None at its end.
pub fn read_line() -> Option<str> {Returns: Option<str>
Defined at line 910
read_stdin
The next n bytes of standard input, or None at its end.
pub fn read_stdin(n: i64) -> Option<str> {Parameters:
n:i64
Returns: Option<str>
Defined at line 919
p_zero_words
Zero n words at p (the compiler clears an owning struct variable with it, proposal 0004).
pub fn p_zero_words(p: i64, n: i64) {Parameters:
p:i64n:i64
Defined at line 929
p_copy_words
Copy n words from src to dst (the compiler snapshots and restores a fixed-size array local for txn { } with it).
pub fn p_copy_words(dst: i64, src: i64, n: i64) {Parameters:
dst:i64src:i64n:i64
Defined at line 942
p_mem_copy
Copy n bytes from src to dst (the areas do not overlap), a word at a time. The native runtimes replace it (pert_mem_copy: msvcrt’s vectorized memcpy on Windows, aligned words on Linux): competitive roadmap OP23; this body is what the interpreter and C run.
pub fn p_mem_copy(dst: i64, src: i64, n: i64) {Parameters:
dst:i64src:i64n:i64
Defined at line 1141
vec_sz_push
pub fn vec_sz_push(v: i64, code: i64, value: i64) {Parameters:
v:i64code:i64value:i64
Defined at line 1205
vec_sz_get
pub fn vec_sz_get(v: i64, idx: i64) -> i64 {Parameters:
v:i64idx:i64
Returns: i64
Defined at line 1212
vec_sz_set
pub fn vec_sz_set(v: i64, idx: i64, value: i64) {Parameters:
v:i64idx:i64value:i64
Defined at line 1223
vec_sz_pop
pub fn vec_sz_pop(v: i64) -> i64 {Parameters:
v:i64
Returns: i64
Defined at line 1238
Vec_drop
Drop one owner of a Vec (proposal 0004): its header is freed, and the last owner of the buffer frees the buffer and drops the elements.
pub fn Vec_drop(v: i64) {Parameters:
v:i64
Defined at line 1345
Vec_init_typed
A Vec whose header is on the stack (LF13: a local that never leaves its function): the header at p set up as Vec_new_typed’s would be.
pub fn Vec_init_typed(p: i64, code: i64, tid: i64) -> i64 {Parameters:
p:i64code:i64tid:i64
Returns: i64
Defined at line 1355
Vec_drop_inplace
Drop what a Vec owns (its elements and its buffer, or one owner of a shared buffer), but not its header: Vec_drop of a heap header, or the whole drop of a header on the stack (LF13).
pub fn Vec_drop_inplace(v: i64) {Parameters:
v:i64
Defined at line 1375
vec_last_owner
Whether this Vec is the last owner of its data: sole (cap >= 0) or the only one left in its share group.
pub fn vec_last_owner(v: i64) -> bool {Parameters:
v:i64
Returns: bool
Defined at line 1429
Vec_drop_strs
Older name: a Vec drops what it owns by its element type now.
pub fn Vec_drop_strs(v: i64) {Parameters:
v:i64
Defined at line 1447
Vec_drop_vecs
Older name: a Vec drops what it owns by its element type now.
pub fn Vec_drop_vecs(v: i64) {Parameters:
v:i64
Defined at line 1452
HashMap_drop
Drop one owner of a map (proposal 0004): its header is freed, and the last owner of the tables drops the keys and values it owns.
pub fn HashMap_drop(m: i64) {Parameters:
m:i64
Defined at line 1458
Vec_share
Copy-on-write: a second owner of a Vec’s data (proposal 0004). Each owner has its own header; a shared buffer gets a box {owners, capacity}, and the capacity slot of each header holds -box-1 (negative, so cap >= 0 still means “sole owner, real capacity”). The first change through one owner copies the buffer (vec_own), the elements counted again by their type.
pub fn Vec_share(v: i64) -> i64 {Parameters:
v:i64
Returns: i64
Defined at line 1513
Vec_share_deep
Older name: the element type in the header says how elements are copied.
pub fn Vec_share_deep(v: i64, kind: i64, words: i64, vec_mask: i64) -> i64 {Parameters:
v:i64kind:i64words:i64vec_mask:i64
Returns: i64
Defined at line 1580
vec_own
Before a change that writes a Vec’s data (or one of its elements): if another Vec shares the data (negative capacity: a box), this Vec takes the buffer over as its last owner, or gets a copy of its own whose elements have one more owner each, so the change is this Vec’s alone.
pub fn vec_own(v: i64) {Parameters:
v:i64
Defined at line 1588
Str_drop
Drop one owner of a string (proposal 0004): its last owner frees a counted string. Literals, uncounted strings and null are left alone; a string already freed through its count stops the program.
pub fn Str_drop(s: i64) {Parameters:
s:i64
Defined at line 1667
Str_dup
One more owner of a string (proposal 0004); returns s.
pub fn Str_dup(s: i64) -> i64 {Parameters:
s:i64
Returns: i64
Defined at line 1706
Vec_push
pub fn Vec_push(v: i64, value: i64) {Parameters:
v:i64value:i64
Defined at line 1737
Vec_pop
The last element, taken out: the caller owns it (proposal 0004). From a shared buffer the element stays the other owners’ too, so it gets one more owner.
pub fn Vec_pop(v: i64) -> i64 {Parameters:
v:i64
Returns: i64
Defined at line 1814
Vec_len
pub fn Vec_len(v: i64) -> i64 {Parameters:
v:i64
Returns: i64
Defined at line 1846
Vec_is_empty
pub fn Vec_is_empty(v: i64) -> bool {Parameters:
v:i64
Returns: bool
Defined at line 1855
Vec_elem_addr
The address of element idx, for &v[i] and &mut v[i] (release D15): the reference points into the buffer, so a write through it changes the Vec. write != 0 first takes the buffer for this Vec alone (it may be shared until its first write). is_struct != 0: the element is a struct; one stored in the buffer (code 16 and up) is reached at its address, one stored boxed (a word) by the pointer in its slot. The borrow checker keeps the Vec unchanged while the reference lives, so the address stays valid.
pub fn Vec_elem_addr(v: i64, idx: i64, write: i64, is_struct: i64) -> i64 {Parameters:
v:i64idx:i64write:i64is_struct:i64
Returns: i64
Defined at line 1871
Vec_get
pub fn Vec_get(v: i64, idx: i64) -> i64 {Parameters:
v:i64idx:i64
Returns: i64
Defined at line 1899
Vec_eq_words
== on two Vecs of numbers or bools (proposal 0001): same length, and equal element by element (word by word).
pub fn Vec_eq_words(a: i64, b: i64) -> bool {Parameters:
a:i64b:i64
Returns: bool
Defined at line 1975
Vec_eq_strs
== on two Vec
pub fn Vec_eq_strs(a: i64, b: i64) -> bool {Parameters:
a:i64b:i64
Returns: bool
Defined at line 1997
Vec_set
Element idx becomes value, which the Vec now owns; the old element is dropped (proposal 0004).
pub fn Vec_set(v: i64, idx: i64, value: i64) {Parameters:
v:i64idx:i64value:i64
Defined at line 2020
Vec_clear
Remove every element; a sole owner drops them.
pub fn Vec_clear(v: i64) {Parameters:
v:i64
Defined at line 2049
Vec_capacity
pub fn Vec_capacity(v: i64) -> i64 {Parameters:
v:i64
Returns: i64
Defined at line 2053
Vec_contains
pub fn Vec_contains(v: i64, value: i64) -> bool {Parameters:
v:i64value:i64
Returns: bool
Defined at line 2069
Vec_first
pub fn Vec_first(v: i64) -> i64 {Parameters:
v:i64
Returns: i64
Defined at line 2110
Vec_last
pub fn Vec_last(v: i64) -> i64 {Parameters:
v:i64
Returns: i64
Defined at line 2142
Vec_truncate
Keep the first n elements; a sole owner drops the rest (shared ones stay the other owners’).
pub fn Vec_truncate(v: i64, n: i64) {Parameters:
v:i64n:i64
Defined at line 2177
Vec_reverse
pub fn Vec_reverse(v: i64) {Parameters:
v:i64
Defined at line 2203
vec_raw_reverse
pub fn vec_raw_reverse(v: i64) {Parameters:
v:i64
Defined at line 2208
Vec_extend
pub fn Vec_extend(v: i64, other: i64) {Parameters:
v:i64other:i64
Defined at line 2252
vec_raw_extend
Append copies of other’s elements (each gets one more owner).
pub fn vec_raw_extend(v: i64, other: i64) {Parameters:
v:i64other:i64
Defined at line 2258
Vec_insert
pub fn Vec_insert(v: i64, idx: i64, value: i64) {Parameters:
v:i64idx:i64value:i64
Defined at line 2324
vec_raw_insert
pub fn vec_raw_insert(v: i64, idx: i64, value: i64) {Parameters:
v:i64idx:i64value:i64
Defined at line 2329
Vec_remove
pub fn Vec_remove(v: i64, idx: i64) -> i64 {Parameters:
v:i64idx:i64
Returns: i64
Defined at line 2385
vec_raw_remove
pub fn vec_raw_remove(v: i64, idx: i64) -> i64 {Parameters:
v:i64idx:i64
Returns: i64
Defined at line 2390
Vec_clone
A Vec of its own with the same elements (each gets one more owner).
pub fn Vec_clone(v: i64) -> i64 {Parameters:
v:i64
Returns: i64
Defined at line 2449
Vec_to_str
pub fn Vec_to_str(v: i64) -> str {Parameters:
v:i64
Returns: str
Defined at line 2485
Vec_sort
Sort ascending (elements compared as i64), in place: heapsort, O(n log n) time and no extra memory.
pub fn Vec_sort(v: i64) {Parameters:
v:i64
Defined at line 2534
vec_raw_sort
pub fn vec_raw_sort(v: i64) {Parameters:
v:i64
Defined at line 2539
p_str_equal
pub fn p_str_equal(a: i64, b: i64) -> bool {Parameters:
a:i64b:i64
Returns: bool
Defined at line 2657
HashMap_new
pub fn HashMap_new() -> i64 {Returns: i64
Defined at line 2742
HashMap_new_typed
An empty map that owns its keys when kown (string keys) and its values as element type vtid says (proposal 0004).
pub fn HashMap_new_typed(kown: bool, vtid: i64) -> i64 {Parameters:
kown:boolvtid:i64
Returns: i64
Defined at line 2757
HashMap_insert_i
pub fn HashMap_insert_i(m: i64, key: i64, value: i64) {Parameters:
m:i64key:i64value:i64
Defined at line 2932
HashMap_get_i
pub fn HashMap_get_i(m: i64, key: i64) -> i64 {Parameters:
m:i64key:i64
Returns: i64
Defined at line 2936
HashMap_contains_i
pub fn HashMap_contains_i(m: i64, key: i64) -> bool {Parameters:
m:i64key:i64
Returns: bool
Defined at line 2940
HashMap_remove_i
pub fn HashMap_remove_i(m: i64, key: i64) {Parameters:
m:i64key:i64
Defined at line 2944
HashMap_get_or_i
pub fn HashMap_get_or_i(m: i64, key: i64, default: i64) -> i64 {Parameters:
m:i64key:i64default:i64
Returns: i64
Defined at line 2948
HashMap_keys_i
pub fn HashMap_keys_i(m: i64) -> i64 {Parameters:
m:i64
Returns: i64
Defined at line 2952
HashMap_values_i
pub fn HashMap_values_i(m: i64) -> i64 {Parameters:
m:i64
Returns: i64
Defined at line 2956
HashMap_share
pub fn HashMap_share(m: i64) -> i64 {Parameters:
m:i64
Returns: i64
Defined at line 2960
map_own
pub fn map_own(m: i64) {Parameters:
m:i64
Defined at line 3000
HashMap_insert
key maps to value; the map owns both (proposal 0004). An existing key is kept and the new one dropped; the old value is dropped.
pub fn HashMap_insert(m: i64, key: i64, value: i64) {Parameters:
m:i64key:i64value:i64
Defined at line 3271
HashMap_get
pub fn HashMap_get(m: i64, key: i64) -> i64 {Parameters:
m:i64key:i64
Returns: i64
Defined at line 3331
HashMap_contains
pub fn HashMap_contains(m: i64, key: i64) -> bool {Parameters:
m:i64key:i64
Returns: bool
Defined at line 3371
HashMap_remove
Remove key; the map drops its key and value.
pub fn HashMap_remove(m: i64, key: i64) {Parameters:
m:i64key:i64
Defined at line 3397
HashMap_len
pub fn HashMap_len(m: i64) -> i64 {Parameters:
m:i64
Returns: i64
Defined at line 3434
HashMap_is_empty
pub fn HashMap_is_empty(m: i64) -> bool {Parameters:
m:i64
Returns: bool
Defined at line 3443
HashMap_clear
Remove every entry; the map drops what it owns.
pub fn HashMap_clear(m: i64) {Parameters:
m:i64
Defined at line 3453
HashMap_keys
The keys in a Vec of their own (sorted for a deterministic order); the Vec owns copies of keys the map owns.
pub fn HashMap_keys(m: i64) -> i64 {Parameters:
m:i64
Returns: i64
Defined at line 3485
HashMap_values
pub fn HashMap_values(m: i64) -> i64 {Parameters:
m:i64
Returns: i64
Defined at line 3527
HashMap_clone
pub fn HashMap_clone(m: i64) -> i64 {Parameters:
m:i64
Returns: i64
Defined at line 3550
p_send_copy
A copy of e, a value of element type tid, sharing nothing with it.
pub fn p_send_copy(e: i64, tid: i64) -> i64 {Parameters:
e:i64tid:i64
Returns: i64
Defined at line 3611
p_str_send_copy
A new string with the bytes of s (a literal is never freed: kept).
pub fn p_str_send_copy(s: i64) -> i64 {Parameters:
s:i64
Returns: i64
Defined at line 3633
Vec_send_copy
A Vec with copies of the elements of v, in a buffer of its own.
pub fn Vec_send_copy(v: i64) -> i64 {Parameters:
v:i64
Returns: i64
Defined at line 3654
HashMap_send_copy
A HashMap with copies of the keys and values of m.
pub fn HashMap_send_copy(m: i64) -> i64 {Parameters:
m:i64
Returns: i64
Defined at line 3691
HashMap_get_or
pub fn HashMap_get_or(m: i64, key: i64, default: i64) -> i64 {Parameters:
m:i64key:i64default:i64
Returns: i64
Defined at line 3747
HashMap_to_str
pub fn HashMap_to_str(m: i64) -> str {Parameters:
m:i64
Returns: str
Defined at line 3790
p_str_from_ptr
pub fn p_str_from_ptr(s: i64) -> str {Parameters:
s:i64
Returns: str
Defined at line 3845
p_str_cstr_len
Bytes before the NUL at s, ignoring any header.
pub fn p_str_cstr_len(s: i64) -> i64 {Parameters:
s:i64
Returns: i64
Defined at line 3856
p_str_adopt
A str made from buf, a raw string its caller owns and gives up (a runtime function’s result, proposal 0004): a counted string or a literal is taken over as it is; anything else is copied, and freed when it is a plain block of the allocator.
pub fn p_str_adopt(buf: i64) -> str {Parameters:
buf:i64
Returns: str
Defined at line 3881
p_str_take
A str of its own for s, a raw string the caller borrows (proposal 0004): a counted string gets one more owner, a literal is itself, anything else (a C string, a plain buffer) is copied; "" for null.
pub fn p_str_take(s: i64) -> str {Parameters:
s:i64
Returns: str
Defined at line 3916
p_str_hdr_len
The length in the header of s, or -1 when it has none.
pub fn p_str_hdr_len(s: i64) -> i64 {Parameters:
s:i64
Returns: i64
Defined at line 3940
p_str_append
s + x where the caller gives s up (s = s + x, s += x, proposal 0004): appended in place when s has one owner and room, else a new string with room to grow, s dropped. The usual s = s + ... loop then costs a copy only each time the length doubles.
pub fn p_str_append(s: i64, x: i64) -> str {Parameters:
s:i64x:i64
Returns: str
Defined at line 3998
p_str_alloc
pub fn p_str_alloc(len: i64) -> i64 {Parameters:
len:i64
Returns: i64
Defined at line 4072
p_str_buf
p_str_alloc with the NUL written: the caller fills len bytes.
pub fn p_str_buf(len: i64) -> i64 {Parameters:
len:i64
Returns: i64
Defined at line 4087
p_str_free
pub fn p_str_free(s: i64) {Parameters:
s:i64
Defined at line 4100
p_str_copy_n
pub fn p_str_copy_n(dst: i64, src: i64, n: i64) {Parameters:
dst:i64src:i64n:i64
Defined at line 4137
String_from
pub fn String_from(s: i64) -> str {Parameters:
s:i64
Returns: str
Defined at line 4151
String_len
pub fn String_len(s: i64) -> i64 {Parameters:
s:i64
Returns: i64
Defined at line 4161
String_is_empty
pub fn String_is_empty(s: i64) -> bool {Parameters:
s:i64
Returns: bool
Defined at line 4165
String_push_str
pub fn String_push_str(s: i64, other: i64) -> str {Parameters:
s:i64other:i64
Returns: str
Defined at line 4177
String_contains
pub fn String_contains(s: i64, sub: i64) -> bool {Parameters:
s:i64sub:i64
Returns: bool
Defined at line 4186
String_starts_with
pub fn String_starts_with(s: i64, prefix: i64) -> bool {Parameters:
s:i64prefix:i64
Returns: bool
Defined at line 4190
String_ends_with
pub fn String_ends_with(s: i64, suffix: i64) -> bool {Parameters:
s:i64suffix:i64
Returns: bool
Defined at line 4202
String_trim
pub fn String_trim(s: i64) -> str {Parameters:
s:i64
Returns: str
Defined at line 4214
String_to_uppercase
pub fn String_to_uppercase(s: i64) -> str {Parameters:
s:i64
Returns: str
Defined at line 4242
String_to_lowercase
pub fn String_to_lowercase(s: i64) -> str {Parameters:
s:i64
Returns: str
Defined at line 4272
String_slice
pub fn String_slice(s: i64, start: i64, end: i64) -> str {Parameters:
s:i64start:i64end:i64
Returns: str
Defined at line 4276
String_slice_len
String_slice for a caller that already knows s is len bytes long: no strlen scan, so slicing a large source token by token stays linear.
pub fn String_slice_len(s: i64, len: i64, start: i64, end: i64) -> str {Parameters:
s:i64len:i64start:i64end:i64
Returns: str
Defined at line 4285
String_find
The first position of sub in s, or -1: the first byte is looked for, then the rest compared a word at a time.
pub fn String_find(s: i64, sub: i64) -> i64 {Parameters:
s:i64sub:i64
Returns: i64
Defined at line 4305
p_mem_find_byte
The index of the first byte b in the n bytes at p, or -1. The native runtimes replace it (pert_mem_find_byte: msvcrt memchr on Windows, a word at a time on Linux): OP23.
pub fn p_mem_find_byte(p: i64, n: i64, b: i64) -> i64 {Parameters:
p:i64n:i64b:i64
Returns: i64
Defined at line 4338
String_rfind
pub fn String_rfind(s: i64, sub: i64) -> i64 {Parameters:
s:i64sub:i64
Returns: i64
Defined at line 4364
String_replace
pub fn String_replace(s: i64, from: i64, to: i64) -> str {Parameters:
s:i64from:i64to:i64
Returns: str
Defined at line 4387
p_bytes_eq
Whether the n bytes at a and b are equal (byte by byte: the interpreter cannot read strings a word at a time; the C backend uses memcmp, fast_core_vec_body).
pub fn p_bytes_eq(a: i64, b: i64, n: i64) -> bool {Parameters:
a:i64b:i64n:i64
Returns: bool
Defined at line 4433
String_split
pub fn String_split(s: i64, delim: i64) -> i64 {Parameters:
s:i64delim:i64
Returns: i64
Defined at line 4453
String_parse_int
pub fn String_parse_int(s: i64) -> i64 {Parameters:
s:i64
Returns: i64
Defined at line 4480
String_char_at
pub fn String_char_at(s: i64, idx: i64) -> str {Parameters:
s:i64idx:i64
Returns: str
Defined at line 4518
p_str_concat_int
s + int_to_str(n) in one allocation: the lowering’s form of that expression (no string for the number alone, made and freed again).
pub fn p_str_concat_int(s: i64, n: i64) -> str {Parameters:
s:i64n:i64
Returns: str
Defined at line 4531
String_repeat
pub fn String_repeat(s: i64, n: i64) -> str {Parameters:
s:i64n:i64
Returns: str
Defined at line 4576
String_to_string
pub fn String_to_string(s: i64) -> str {Parameters:
s:i64
Returns: str
Defined at line 4590
String_clone
pub fn String_clone(s: i64) -> str {Parameters:
s:i64
Returns: str
Defined at line 4594
String_bytes
pub fn String_bytes(s: i64) -> i64 {Parameters:
s:i64
Returns: i64
Defined at line 4598
StringBuilder
pub struct StringBuilder {Fields:
| Name | Type |
|---|---|
handle | i64 |
len | i64 |
Defined at line 4613
StringBuilder
impl StringBuilder {Defined at line 4618
String_byte_at
pub fn String_byte_at(s: i64, idx: i64) -> i64 {Parameters:
s:i64idx:i64
Returns: i64
Defined at line 4663
String_char_count
pub fn String_char_count(s: i64) -> i64 {Parameters:
s:i64
Returns: i64
Defined at line 4699
char_to_str
pub fn char_to_str(b: i64) -> str {Parameters:
b:i64
Returns: str
Defined at line 4703
char_is_digit
pub fn char_is_digit(b: i64) -> bool {Parameters:
b:i64
Returns: bool
Defined at line 4707
char_is_alpha
pub fn char_is_alpha(b: i64) -> bool {Parameters:
b:i64
Returns: bool
Defined at line 4711
char_is_whitespace
pub fn char_is_whitespace(b: i64) -> bool {Parameters:
b:i64
Returns: bool
Defined at line 4715
char_is_upper
pub fn char_is_upper(b: i64) -> bool {Parameters:
b:i64
Returns: bool
Defined at line 4719
char_is_lower
pub fn char_is_lower(b: i64) -> bool {Parameters:
b:i64
Returns: bool
Defined at line 4723
char_to_upper
pub fn char_to_upper(b: i64) -> i64 {Parameters:
b:i64
Returns: i64
Defined at line 4727
char_to_lower
pub fn char_to_lower(b: i64) -> i64 {Parameters:
b:i64
Returns: i64
Defined at line 4734
ByteBuffer
pub struct ByteBuffer {Fields:
| Name | Type |
|---|---|
data | Vec<i64> |
len | i64 |
Defined at line 4747
ByteBuffer
impl ByteBuffer {Defined at line 4752
str_bytes
Iterate over the bytes of a string, returning a Vec of byte values. Usage: value bytes = str_bytes("hello"); // [104, 101, 108, 108, 111]
pub fn str_bytes(s: str) -> Vec<i64> {Parameters:
s:str
Returns: Vec<i64>
Defined at line 4841
str_from_bytes
Build a string from a Vec of byte values. Linear: one counted allocation + a byte copy (was a concat per byte, quadratic — a multi-MB body took minutes).
pub fn str_from_bytes(bytes: Vec<i64>) -> str {Parameters:
bytes:Vec<i64>
Returns: str
Defined at line 4861
str_slice
Get a substring by byte range [start, end).
pub fn str_slice(s: str, start: i64, end: i64) -> str {Parameters:
s:strstart:i64end:i64
Returns: str
Defined at line 4879
str_slice_len
str_slice when the length of s is already known (len bytes).
pub fn str_slice_len(s: str, len: i64, start: i64, end: i64) -> str {Parameters:
s:strlen:i64start:i64end:i64
Returns: str
Defined at line 4896
str_starts_with
Check if a string starts with a prefix.
pub fn str_starts_with(s: str, prefix: str) -> bool {Parameters:
s:strprefix:str
Returns: bool
Defined at line 4901
str_ends_with
Check if a string ends with a suffix.
pub fn str_ends_with(s: str, suffix: str) -> bool {Parameters:
s:strsuffix:str
Returns: bool
Defined at line 4906
str_contains
Check if a string contains a substring.
pub fn str_contains(s: str, sub: str) -> bool {Parameters:
s:strsub:str
Returns: bool
Defined at line 4911
str_find
Find the first index of a substring, or -1 if not found.
pub fn str_find(s: str, sub: str) -> i64 {Parameters:
s:strsub:str
Returns: i64
Defined at line 4916
str_rfind
Find the last index of a substring, or -1 if not found.
pub fn str_rfind(s: str, sub: str) -> i64 {Parameters:
s:strsub:str
Returns: i64
Defined at line 4921
str_trim_start
Trim leading whitespace from a string.
pub fn str_trim_start(s: str) -> str {Parameters:
s:str
Returns: str
Defined at line 4926
str_trim_end
Trim trailing whitespace from a string.
pub fn str_trim_end(s: str) -> str {Parameters:
s:str
Returns: str
Defined at line 4948
str_trim
Trim both leading and trailing whitespace.
pub fn str_trim(s: str) -> str {Parameters:
s:str
Returns: str
Defined at line 4970
str_lines
Split a string into lines by newline (LF).
pub fn str_lines(s: str) -> Vec<str> {Parameters:
s:str
Returns: Vec<str>
Defined at line 4975
str_trim_end_char
Trim trailing copies of ch (plus spaces/tabs) from the end.
pub fn str_trim_end_char(s: str, ch: i64) -> str {Parameters:
s:strch:i64
Returns: str
Defined at line 4994
str_split
Split a string by delimiter, returning a Vec of string parts.
pub fn str_split(s: str, delim: str) -> Vec<str> {Parameters:
s:strdelim:str
Returns: Vec<str>
Defined at line 5011
str_split_char
Split a string by a single character delimiter, returning a Vec of parts. Faster than str_split for single-char delimiters.
pub fn str_split_char(s: str, delim: i64) -> Vec<str> {Parameters:
s:strdelim:i64
Returns: Vec<str>
Defined at line 5055
str_replace
Replace all occurrences of from with to in a string.
pub fn str_replace(s: str, from: str, to: str) -> str {Parameters:
s:strfrom:strto:str
Returns: str
Defined at line 5078
str_clone
An owned copy of a string: how a borrowed &str is kept past its owner (release M11). Always a new allocation.
pub fn str_clone(s: str) -> str {Parameters:
s:str
Returns: str
Defined at line 5084
str_repeat
Repeat a string n times.
pub fn str_repeat(s: str, n: i64) -> str {Parameters:
s:strn:i64
Returns: str
Defined at line 5090
str_to_upper
Convert a string to uppercase.
pub fn str_to_upper(s: str) -> str {Parameters:
s:str
Returns: str
Defined at line 5095
str_to_lower
Convert a string to lowercase.
pub fn str_to_lower(s: str) -> str {Parameters:
s:str
Returns: str
Defined at line 5100
str_parse_int
Parse a decimal integer from a string. Returns 0 on failure.
pub fn str_parse_int(s: str) -> i64 {Parameters:
s:str
Returns: i64
Defined at line 5105
str_parse_int_range
Parse an integer from a substring [start, end) of a string. Useful for the lexer which has already extracted digit positions.
pub fn str_parse_int_range(s: str, start: i64, end: i64) -> i64 {Parameters:
s:strstart:i64end:i64
Returns: i64
Defined at line 5194
str_byte_at
Get the byte at a given index, or -1 if out of bounds.
pub fn str_byte_at(s: str, idx: i64) -> i64 {Parameters:
s:stridx:i64
Returns: i64
Defined at line 5226
str_len
Get the length of a string in bytes.
pub fn str_len(s: str) -> i64 {Parameters:
s:str
Returns: i64
Defined at line 5231
str_is_empty
Check if a string is empty.
pub fn str_is_empty(s: str) -> bool {Parameters:
s:str
Returns: bool
Defined at line 5236
str_concat
Concatenate two strings.
pub fn str_concat(a: str, b: str) -> str {Parameters:
a:strb:str
Returns: str
Defined at line 5241
str_compare
Compare two strings. Returns 0 if equal, negative if a < b, positive if a > b.
pub fn str_compare(a: str, b: str) -> i64 {Parameters:
a:strb:str
Returns: i64
Defined at line 5246
str_equal
Check if two strings are equal.
pub fn str_equal(a: str, b: str) -> bool {Parameters:
a:strb:str
Returns: bool
Defined at line 5251
int_to_str
Convert an integer to a string.
pub fn int_to_str(n: i64) -> str {Parameters:
n:i64
Returns: str
Defined at line 5256
u64_to_str
A u64 as unsigned decimal text (print of a u64 uses this).
pub fn u64_to_str(x: u64) -> str {Parameters:
x:u64
Returns: str
Defined at line 5261
float_to_str
Convert a float to a string (SH-4.1).
pub fn float_to_str(f: f64) -> str {Parameters:
f:f64
Returns: str
Defined at line 5271
str_parse_float
Parse a float from a string. Returns 0.0 on failure (SH-4.1).
pub fn str_parse_float(s: str) -> f64 {Parameters:
s:str
Returns: f64
Defined at line 5276
byte_to_str
Convert a byte value to a single-character string.
pub fn byte_to_str(b: i64) -> str {Parameters:
b:i64
Returns: str
Defined at line 5281
Generated by scribe, the Fides documentation generator