lisette-stdlib 0.1.13

Little language inspired by Rust that compiles to Go
Documentation
// Generated by Lisette bindgen
// Source: index/suffixarray (Go stdlib)
// Go: 1.25.5
// Lisette: 0.1.12

import "go:io"
import "go:regexp"

pub fn New(data: Slice<uint8>) -> Ref<Index>

/// Index implements a suffix array for fast substring search.
pub type Index

impl Index {
  /// Bytes returns the data over which the index was created.
  /// It must not be modified.
  fn Bytes(self: Ref<Index>) -> Slice<uint8>

  /// FindAllIndex returns a sorted list of non-overlapping matches of the
  /// regular expression r, where a match is a pair of indices specifying
  /// the matched slice of x.Bytes(). If n < 0, all matches are returned
  /// in successive order. Otherwise, at most n matches are returned and
  /// they may not be successive. The result is nil if there are no matches,
  /// or if n == 0.
  fn FindAllIndex(self: Ref<Index>, r: Ref<regexp.Regexp>, n: int) -> Slice<Slice<int>>

  /// Lookup returns an unsorted list of at most n indices where the byte string s
  /// occurs in the indexed data. If n < 0, all occurrences are returned.
  /// The result is nil if s is empty, s is not found, or n == 0.
  /// Lookup time is O(log(N)*len(s) + len(result)) where N is the
  /// size of the indexed data.
  fn Lookup(self: Ref<Index>, s: Slice<uint8>, n: int) -> Slice<int>

  /// Read reads the index from r into x; x must not be nil.
  fn Read(self: Ref<Index>, r: io.Reader) -> Result<(), error>

  /// Write writes the index x to w.
  fn Write(self: Ref<Index>, w: io.Writer) -> Result<(), error>
}