API
#maps
Xu 0.8.8 API
import: #maps
counts: 4 函数, 22 方法, 2 类型, 0 常量, 0 方法集
库形 StrInt/StrStr。语言 map[K]V 是内建,不经本包。
struct StrInt
pub struct StrInt {
pub keys []string
pub vals []int
pub used []int
pub n int
pub cap int
}
用途
公开结构体 `StrInt`。
参数
keys []string- 字段([]string)
vals []int- 字段([]int)
used []int- 字段([]int)
n int- 数量、长度或上限
cap int- 字段(int)
struct StrStr
pub struct StrStr {
pub keys []string
pub vals []string
pub used []int
pub n int
pub cap int
}
用途
公开结构体 `StrStr`。
参数
keys []string- 字段([]string)
vals []string- 字段([]string)
used []int- 字段([]int)
n int- 数量、长度或上限
cap int- 字段(int)
new_str_int
pub fn new_str_int() StrInt
用途
构造 str int。
参数
无
返回
StrInt — 该类型的值
new_str_str
pub fn new_str_str() StrStr
用途
构造 str str。
参数
无
返回
StrStr — 该类型的值
(&mut StrInt) set
pub fn (m &mut StrInt) set(k string, v int)
用途
在 `&mut StrInt` 上调用 `set`。
参数
m &mut StrInt- 接收者 &mut StrInt(可变借用)
k string- 键或下标(string)
v int- 值(int)
(&mut StrStr) set
pub fn (m &mut StrStr) set(k string, v string)
用途
在 `&mut StrStr` 上调用 `set`。
参数
m &mut StrStr- 接收者 &mut StrStr(可变借用)
k string- 键或下标(string)
v string- 值(string)
(&StrInt) has
pub fn (m &StrInt) has(k string) bool
用途
`&StrInt` 上的方法:是否具有。
参数
m &StrInt- 接收者 &StrInt(借用)
k string- 键或下标(string)
返回
bool — 是否成立
(&StrStr) has
pub fn (m &StrStr) has(k string) bool
用途
`&StrStr` 上的方法:是否具有。
参数
m &StrStr- 接收者 &StrStr(借用)
k string- 键或下标(string)
返回
bool — 是否成立
(&StrInt) get
pub fn (m &StrInt) get(k string) int
用途
在 `&StrInt` 上调用 `get`。失败时 throw。
参数
m &StrInt- 接收者 &StrInt(借用)
k string- 键或下标(string)
返回
int — 该类型的值
(&StrStr) get
pub fn (m &StrStr) get(k string) string
用途
在 `&StrStr` 上调用 `get`。失败时 throw。
参数
m &StrStr- 接收者 &StrStr(借用)
k string- 键或下标(string)
返回
string — 结果字符串
(&mut StrInt) del
pub fn (m &mut StrInt) del(k string)
用途
在 `&mut StrInt` 上调用 `del`。
参数
m &mut StrInt- 接收者 &mut StrInt(可变借用)
k string- 键或下标(string)
(&mut StrStr) del
pub fn (m &mut StrStr) del(k string)
用途
在 `&mut StrStr` 上调用 `del`。
参数
m &mut StrStr- 接收者 &mut StrStr(可变借用)
k string- 键或下标(string)
(&mut StrInt) clear
pub fn (m &mut StrInt) clear()
用途
在 `&mut StrInt` 上调用 `clear`。
参数
m &mut StrInt- 接收者 &mut StrInt(可变借用)
(&mut StrStr) clear
pub fn (m &mut StrStr) clear()
用途
在 `&mut StrStr` 上调用 `clear`。
参数
m &mut StrStr- 接收者 &mut StrStr(可变借用)
(&StrInt) len
pub fn (m &StrInt) len() int
用途
`&StrInt` 上的方法:返回长度。
参数
m &StrInt- 接收者 &StrInt(借用)
返回
int — 该类型的值
(&StrStr) len
pub fn (m &StrStr) len() int
用途
`&StrStr` 上的方法:返回长度。
参数
m &StrStr- 接收者 &StrStr(借用)
返回
int — 该类型的值
(&StrInt) keys
pub fn (m &StrInt) keys() []string
用途
在 `&StrInt` 上调用 `keys`。
参数
m &StrInt- 接收者 &StrInt(借用)
返回
[]string — 切片结果
(&StrStr) keys
pub fn (m &StrStr) keys() []string
用途
在 `&StrStr` 上调用 `keys`。
参数
m &StrStr- 接收者 &StrStr(借用)
返回
[]string — 切片结果
(&StrInt) values
pub fn (m &StrInt) values() []int
用途
在 `&StrInt` 上调用 `values`。
参数
m &StrInt- 接收者 &StrInt(借用)
返回
[]int — 切片结果
(&StrStr) values
pub fn (m &StrStr) values() []string
用途
在 `&StrStr` 上调用 `values`。
参数
m &StrStr- 接收者 &StrStr(借用)
返回
[]string — 切片结果
(&StrInt) clone
pub fn (m &StrInt) clone() StrInt
用途
`&StrInt` 上的方法:拷贝一份独立的 string。
参数
m &StrInt- 接收者 &StrInt(借用)
返回
StrInt — 该类型的值
(&StrStr) clone
pub fn (m &StrStr) clone() StrStr
用途
`&StrStr` 上的方法:拷贝一份独立的 string。
参数
m &StrStr- 接收者 &StrStr(借用)
返回
StrStr — 该类型的值
(&StrInt) equal
pub fn (m &StrInt) equal(o &StrInt) bool
用途
`&StrInt` 上的方法:判断两值是否相等。
参数
m &StrInt- 接收者 &StrInt(借用)
o &StrInt- o(借用,调用方仍持有;类型 &StrInt)
返回
bool — 是否成立
(&StrStr) equal
pub fn (m &StrStr) equal(o &StrStr) bool
用途
`&StrStr` 上的方法:判断两值是否相等。
参数
m &StrStr- 接收者 &StrStr(借用)
o &StrStr- o(借用,调用方仍持有;类型 &StrStr)
返回
bool — 是否成立
copy_str_int
pub fn copy_str_int(dst &mut StrInt, src &StrInt)
用途
拷贝strint。
参数
dst &mut StrInt- 目标(独占借用;类型 &mut StrInt)
src &StrInt- 源数据(借用,调用方仍持有;类型 &StrInt)
copy_str_str
pub fn copy_str_str(dst &mut StrStr, src &StrStr)
用途
拷贝strstr。
参数
dst &mut StrStr- 目标(独占借用;类型 &mut StrStr)
src &StrStr- 源数据(借用,调用方仍持有;类型 &StrStr)
(&mut StrInt) delete_func
pub fn (m &mut StrInt) delete_func(f fn(string, int) bool)
用途
`&mut StrInt` 上的方法:删除回调。
参数
m &mut StrInt- 接收者 &mut StrInt(可变借用)
f fn(string, int) bool- 字节回调:参数为字节值 0..255,返回是否命中
(&mut StrStr) delete_func
pub fn (m &mut StrStr) delete_func(f fn(string, string) bool)
用途
`&mut StrStr` 上的方法:删除回调。
参数
m &mut StrStr- 接收者 &mut StrStr(可变借用)
f fn(string, string) bool- 字节回调:参数为字节值 0..255,返回是否命中