API
#runtime
Xu 0.8.8 API
import: #runtime
counts: 14 fns, 0 methods, 1 types, 0 consts, 0 ifaces
caller(skip) allows constant skip 0 or 1 only.
struct Frame
pub struct Frame {
pub file string
pub line int
pub ok bool
}
Purpose
Compile-time callsite frame. `caller(0)` and `caller(1)` are rewritten to a Frame literal for this call site. Other skip values are rejected at compile time (no runtime stack walk).
Parameters
file string- field (string)
line int- field (int)
ok bool- field (bool)
caller
pub fn caller(skip int) Frame
Purpose
caller; returns Frame.
Parameters
skip int- skip (int)
Returns
Frame — a value of this type
map_mix64
pub fn map_mix64(value int) int
Purpose
Pure ordinary Xu policy. No Assembler, container allocation or raw memory capability: native map adapters supply scalar state and borrowed keys. Arithmetic is modulo 2^64; masks turn Xu's signed shifts into logical shifts.
Parameters
value int- value (int)
Returns
int — a value of this type
map_hash_int
pub fn map_hash_int(key int, seed int) int
Purpose
Map hash int.
Parameters
key int- key (int)
seed int- random seed (int)
Returns
int — a value of this type
map_hash_string
pub fn map_hash_string(key &string, seed int) int
Purpose
Map hash string.
Parameters
key &string- key (borrowed; caller keeps it; type &string)
seed int- random seed (int)
Returns
int — a value of this type
map_insert_action
pub fn map_insert_action(live int, used int, cap int) int
Purpose
0=keep, 1=grow, 2=compact. Native storage guarantees 0<=live<=used<=cap and power-of-two cap>=16. cap-cap/4 avoids overflow at large capacities.
Parameters
live int- live (int)
used int- used (int)
cap int- cap (int)
Returns
int — a value of this type
starts_with
pub fn starts_with(s &string, prefix &string) bool
Purpose
starts_with(s, prefix) → bool. S7 guard: negative descriptor lengths fail-loud. No arbitrary size cap — prefixes may come from runtime data.
Parameters
s &string- source string (borrowed; caller keeps it; type &string)
prefix &string- prefix (borrowed; caller keeps it; type &string)
Returns
bool — true or false
is_digit
pub fn is_digit(c int) bool
Purpose
ASCII character predicates. Ranges are the historical byte ranges only do not widen to Unicode whitespace or locale classes.
Parameters
c int- byte or character code (int)
Returns
bool — true or false
is_alpha
pub fn is_alpha(c int) bool
Purpose
Whether it is alpha.
Parameters
c int- byte or character code (int)
Returns
bool — true or false
is_alnum
pub fn is_alnum(c int) bool
Purpose
Whether it is alnum.
Parameters
c int- byte or character code (int)
Returns
bool — true or false
is_space
pub fn is_space(c int) bool
Purpose
Whether it is space.
Parameters
c int- byte or character code (int)
Returns
bool — true or false
itoa
pub fn itoa(n int) string
Purpose
itoa(n) uses a decimal slice buffer and single-argument string_from_bytes. Keep the quotient signed; negating only the remainder handles INT_MIN.
Parameters
n int- count, length, or limit (int)
Returns
string — result string
parse_int
pub fn parse_int(s &string) int
Purpose
Parse as int. Throws on failure.
Parameters
s &string- source string (borrowed; caller keeps it; type &string)
Returns
int — a value of this type
str_bytes
pub fn str_bytes(s &string) []int
Purpose
str_bytes(s) → []int of byte values. Ordinary replacement for rt_emit_str_bytes / s.bytes. Bounded index loop, first-stage array base.
Parameters
s &string- source string (borrowed; caller keeps it; type &string)
Returns
[]int — slice result
str_runes
pub fn str_runes(s &string) []int
Purpose
str_runes(s) → []int of codepoints. Ordinary replacement for rt_emit_str_runes / s.runes. Invalid UTF-8 fail-louds (stderr + exit 1). Helpers take &string so heap strings are not cloned per codepoint.
Parameters
s &string- source string (borrowed; caller keeps it; type &string)
Returns
[]int — slice result