struct Index
XuAPI
pub struct Index {
pub data string
pub sa []int
}Purpose
Structure encapsulating data, sa.
Public fields
datastring- data
sa[]int- field ([]int)
#index/suffixarraySuffix array lookup / find_all_index.
struct Indexpub struct Index {
pub data string
pub sa []int
}Structure encapsulating data, sa.
data stringsa []intnewpub fn new(data &string) IndexConstruct a new value of this type.
data &stringIndex — a value of this type
lookuppub fn lookup(x &Index, s &string, n int) []intLook up matching key or item in index or collection.
x &Indexs &stringn int[]int — slice result
struct Matchpub struct Match {
pub from int
pub to int
}Match is a half-open [from, to) index into the indexed string.
from intto intfind_all_indexpub fn find_all_index(x &Index, s &string, n int) []MatchFindAllIndex aligned with Index.FindAllIndex.
x &Indexs &stringn int[]Match — slice result
(Index) lenpub fn (x Index) len() intOperation on Index: return the length.
x IndexIndex instance used by this call (value receiver).int — a value of this type