struct Index
XuAPI
pub struct Index {
pub data string
pub sa []int
}用途
承载 data、sa 等属性的结构体。
公开字段
datastring- 数据
sa[]int- 字段([]int)
#index/suffixarray后缀数组 lookup / find_all_index。
struct Indexpub struct Index {
pub data string
pub sa []int
}承载 data、sa 等属性的结构体。
data stringsa []intnewpub fn new(data &string) Index构造该类型的新值。
data &stringIndex — 该类型的值
lookuppub fn lookup(x &Index, s &string, n int) []int在索引或集合中查找匹配的键或项。
x &Indexs &stringn int[]int — 切片结果
struct Matchpub struct Match {
pub from int
pub to int
}承载 from、to 等属性的结构体。
from intto intfind_all_indexpub fn find_all_index(x &Index, s &string, n int) []Match执行 find all index 操作。
x &Indexs &stringn int[]Match — 切片结果
(Index) lenpub fn (x Index) len() intIndex 上的操作:返回长度。
x IndexIndex 实例;按值接收。int — 该类型的值