package warpc
import "github.com/gohugoio/hugo/internal/warpc"
Index ¶
- Variables
- type Binary
- type CompileModuleContext
- type CompiledModule
- type Dispatcher
- type Dispatchers
- func AllDispatchers(katexOpts Options) *Dispatchers
- func (d *Dispatchers) Close() error
- func (d *Dispatchers) Katex() (Dispatcher[KatexInput, KatexOutput], error)
- type Header
- type KatexInput
- type KatexOptions
- type KatexOutput
- type Message
- type Options
Variables ¶
Types ¶
type Binary ¶
type Binary struct { // The name of the binary. // For quickjs, this must match the instance import name, "javy_quickjs_provider_v2". // For the main module, we only use this for caching. Name string // THe wasm binary. Data []byte }
Binary represents a WebAssembly binary.
type CompileModuleContext ¶
type CompiledModule ¶
type CompiledModule struct { // Runtime (e.g. QuickJS) may be nil if not needed (e.g. embedded in Module). Runtime wazero.CompiledModule // If Runtime is not nil, this should be the name of the instance. RuntimeName string // The main module to instantiate. // This will be insantiated multiple times in a pool, // so it does not need a name. Module wazero.CompiledModule }
type Dispatcher ¶
type Dispatcher[Q, R any] interface { Execute(ctx context.Context, q Message[Q]) (Message[R], error) Close() error }
func Start ¶
func Start[Q, R any](opts Options) (Dispatcher[Q, R], error)
Start creates a new dispatcher pool.
type Dispatchers ¶
type Dispatchers struct {
// contains filtered or unexported fields
}
Dispatchers holds all the dispatchers for the warpc package.
func AllDispatchers ¶
func AllDispatchers(katexOpts Options) *Dispatchers
AllDispatchers creates all the dispatchers for the warpc package. Note that the individual dispatchers are started lazily. Remember to call Close on the returned Dispatchers when done.
func (*Dispatchers) Close ¶
func (d *Dispatchers) Close() error
func (*Dispatchers) Katex ¶
func (d *Dispatchers) Katex() (Dispatcher[KatexInput, KatexOutput], error)
type Header ¶
type Header struct { // Major version of the protocol. Version uint16 `json:"version"` // Unique ID for the request. // Note that this only needs to be unique within the current request set time window. ID uint32 `json:"id"` // Set in the response if there was an error. Err string `json:"err"` }
Header is in both the request and response.
type KatexInput ¶
type KatexInput struct { Expression string `json:"expression"` Options KatexOptions `json:"options"` }
See https://katex.org/docs/options.html
type KatexOptions ¶
type KatexOptions struct { // html, mathml (default), htmlAndMathml Output string `json:"output"` // If true, display math in display mode, false in inline mode. DisplayMode bool `json:"displayMode"` // Render \tags on the left side instead of the right. Leqno bool `json:"leqno"` // If true, render flush left with a 2em left margin. Fleqn bool `json:"fleqn"` // The color used for typesetting errors. // A color string given in the format "#XXX" or "#XXXXXX" ErrorColor string `json:"errorColor"` // A collection of custom macros. Macros map[string]string `json:"macros,omitempty"` // Specifies a minimum thickness, in ems, for fraction lines. MinRuleThickness float64 `json:"minRuleThickness"` // If true, KaTeX will throw a ParseError when it encounters an unsupported command. ThrowOnError bool `json:"throwOnError"` }
KatexOptions defines the options for the KaTeX rendering. See https://katex.org/docs/options.html
type KatexOutput ¶
type KatexOutput struct { Output string `json:"output"` }
type Message ¶
func (Message[T]) GetID ¶
type Options ¶
type Options struct { Ctx context.Context Infof func(format string, v ...any) // E.g. quickjs wasm. May be omitted if not needed. Runtime Binary // The main module to instantiate. Main Binary CompilationCacheDir string PoolSize int // Memory limit in MiB. Memory int }
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
internal/warpc/gen |
- Version
- v0.144.2 (latest)
- Published
- Feb 19, 2025
- Platform
- linux/amd64
- Imports
- 17 packages
- Last checked
- 17 hours ago –
Tools for package owners.