wasm

package
v0.0.11-0ad3421 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildImports

func BuildImports(ctx context.Context, waRT wazero.Runtime, embindEngine embind.Engine, compiledMod wazero.CompiledModule) error

BuildImports implements or mocks the host imports required by Tesseract's compiled WASM module.

func CompileTesseract

func CompileTesseract(ctx context.Context, waRT wazero.Runtime, embEng embind.Engine, cfg CompileConfig) (api.Module, error)

func GetReaderSize

func GetReaderSize(ctx context.Context, readerPtr *io.Reader) (uint32, error)

GetReaderSize attempts to optimally determine an io.Reader's size, with special support for bytes.Buffer like objects, or os.File like objects. Takes a pointer to the reader in case it needs to replace it with a copy (worst case).

func ReadString

func ReadString[T constraints.Integer](mem api.Memory, rawStrPtr T) string

ReadString reads from the provided pointer until we reach a 0. If 0 is not found, returns an empty string. If WASM doesn't need it afterwards, use ReadAndFreeString instead.

Types

type CompileConfig

type CompileConfig struct {
	// Stderr and Stdout enable redirection of any logs. If left nil they point at os.Stderr and os.Stdout. Turn off by setting them to io.Discard
	Stderr, Stdout io.Writer
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL