XU XUv0.16.0

#index/suffixarray

import: #index/suffixarray

counts: 3 functions, 1 methods, 2 types, 0 constants, 0 method sets

Suffix array lookup / find_all_index.

struct Index

XuAPI
pub struct Index {
    pub data string
    pub sa []int
}

Purpose

Structure encapsulating data, sa.

Public fields

data string
data
sa []int
field ([]int)

new

XuAPI
pub fn new(data &string) Index

Purpose

Construct a new value of this type.

Parameters

data &string
data (read-only borrow; caller keeps the original; type &string)

Returns

Index — a value of this type

lookup

XuAPI
pub fn lookup(x &Index, s &string, n int) []int

Purpose

Look up matching key or item in index or collection.

Parameters

x &Index
value (read-only borrow; caller keeps the original; type &Index)
s &string
source string (read-only borrow; caller keeps the original; type &string)
n int
count, length, or limit (int)

Returns

[]int — slice result

struct Match

XuAPI
pub struct Match {
    pub from int
    pub to int
}

Purpose

Match is a half-open [from, to) index into the indexed string.

Public fields

from int
field (int)
to int
field (int)

find_all_index

XuAPI
pub fn find_all_index(x &Index, s &string, n int) []Match

Purpose

FindAllIndex aligned with Index.FindAllIndex.

Parameters

x &Index
value (read-only borrow; caller keeps the original; type &Index)
s &string
source string (read-only borrow; caller keeps the original; type &string)
n int
count, length, or limit (int)

Returns

[]Match — slice result

(Index) len

XuAPI
pub fn (x Index) len() int

Purpose

Operation on Index: return the length.

Parameters

x Index
The Index instance used by this call (value receiver).

Returns

int — a value of this type