XU XUv0.16.0

#runtime

导入方式: #runtime

公开 API: 14 函数, 0 方法, 1 类型, 0 常量, 0 方法集

caller(skip) 仅允许常量 skip 0 或 1。

struct Frame

XuAPI
pub struct Frame {
    pub file string
    pub line int
    pub ok bool
}

用途

Runtime 协议数据帧结构封装。

公开字段

file string
字段(string)
line int
字段(int)
ok bool
字段(bool)

caller

XuAPI
pub fn caller(skip int) Frame

用途

执行 caller 处理。

参数

skip int
skip(int)

返回值

Frame — 该类型的值

map_mix64

XuAPI
pub fn map_mix64(value int) int

用途

执行 map mix64 操作。

参数

value int
value(int)

返回值

int — 该类型的值

map_hash_int

XuAPI
pub fn map_hash_int(key int, seed int) int

用途

执行 map hash int 操作。

参数

key int
键(int)
seed int
随机种子(int)

返回值

int — 该类型的值

map_hash_string

XuAPI
pub fn map_hash_string(key &string, seed int) int

用途

执行 map hash string 操作。

参数

key &string
键(只读借用,调用方仍持有原值;类型 &string)
seed int
随机种子(int)

返回值

int — 该类型的值

map_insert_action

XuAPI
pub fn map_insert_action(live int, used int, cap int) int

用途

执行 map insert action 操作。

参数

live int
live(int)
used int
used(int)
cap int
cap(int)

返回值

int — 该类型的值

starts_with

XuAPI
pub fn starts_with(s &string, prefix &string) bool

用途

判断是否以给定前缀开头。

参数

s &string
源字符串(只读借用,调用方仍持有原值;类型 &string)
prefix &string
前缀(只读借用,调用方仍持有原值;类型 &string)

返回值

bool — 是否成立

is_digit

XuAPI
pub fn is_digit(c int) bool

用途

判断是否 digit。

参数

c int
字节或字符码(int)

返回值

bool — 是否成立

is_alpha

XuAPI
pub fn is_alpha(c int) bool

用途

判断是否 alpha。

参数

c int
字节或字符码(int)

返回值

bool — 是否成立

is_alnum

XuAPI
pub fn is_alnum(c int) bool

用途

判断是否 alnum。

参数

c int
字节或字符码(int)

返回值

bool — 是否成立

is_space

XuAPI
pub fn is_space(c int) bool

用途

判断是否 space。

参数

c int
字节或字符码(int)

返回值

bool — 是否成立

itoa

XuAPI
pub fn itoa(n int) string

用途

把 int 转成十进制字符串。

参数

n int
数量、长度或上限(int)

返回值

string — 结果字符串

parse_int

XuAPI
pub fn parse_int(s &string) int

用途

解析为 int。失败时抛出错误,调用方需处理或继续传播。

参数

s &string
源字符串(只读借用,调用方仍持有原值;类型 &string)

返回值

int — 该类型的值

str_bytes

XuAPI
pub fn str_bytes(s &string) []int

用途

执行 str bytes 操作。

参数

s &string
源字符串(只读借用,调用方仍持有原值;类型 &string)

返回值

[]int — 切片结果

str_runes

XuAPI
pub fn str_runes(s &string) []int

用途

执行 str runes 操作。

参数

s &string
源字符串(只读借用,调用方仍持有原值;类型 &string)

返回值

[]int — 切片结果