genrust

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorVariantNames

func ErrorVariantNames(errorTypes []*onkir.Message) []string

func GenerateClient

func GenerateClient(file *onkir.File) []byte

func GenerateClientWithResolver

func GenerateClientWithResolver(file *onkir.File, resolver PackageResolver) []byte

func GenerateServer

func GenerateServer(file *onkir.File) []byte

func GenerateServerWithResolver

func GenerateServerWithResolver(file *onkir.File, resolver PackageResolver) []byte

func GenerateTypes

func GenerateTypes(file *onkir.File) []byte

func GenerateTypesWithResolver

func GenerateTypesWithResolver(file *onkir.File, resolver PackageResolver) []byte

func OneofTypeName

func OneofTypeName(message *onkir.Message, field *onkir.Field) string

func PascalCase

func PascalCase(value string) string

PascalCase converts a schema name to the Rust type / enum variant spelling. The result is passed through mangleNonRawKeyword because `self` PascalCases to `Self`, one of the four keywords that cannot be raw-escaped.

func RustEnumName

func RustEnumName(enum *onkir.Enum) string

func RustIdent

func RustIdent(value string) string

func RustMessageName

func RustMessageName(message *onkir.Message) string

func RustScalarType

func RustScalarType(kind onkir.ScalarKind) string

func SnakeCase

func SnakeCase(value string) string

func WriteWSClientRuntime

func WriteWSClientRuntime(p *Printer, hasWSCorrelation bool)

WriteWSClientRuntime emits the client-side runtime shared by every @ws method in the file: WsFrameSocket (typed send/receive/close over a mutex- guarded split sink/stream - fixes the pre-existing lack of write serialization, and now actually encodes/decodes instead of passing raw strings), and, when any method uses @ws_id, WsCallSocket (adds Call and a background reader task routing correlated replies away from receive()).

func WriteWSServerRuntime

func WriteWSServerRuntime(p *Printer, hasWSCorrelation bool)

WriteWSServerRuntime emits the server-side runtime shared by every @ws method in the file: WsSink (mutex-guarded, Clone - so a handler can retain it and send from a spawned task, and so the read loop above can hand a fresh clone to every frame's handler call without moving it away), and, when any method uses @ws_id, WsPending (the correlation map) and WsCallSink (WsSink plus the Call helper).

Types

type PackageRef

type PackageRef struct {
	ModulePath string
}

PackageRef is a module path from the generated Rust source file to another generated directory's types module.

type PackageResolver

type PackageResolver interface {
	ResolveMessage(message *onkir.Message) (PackageRef, bool)
	ResolveEnum(enum *onkir.Enum) (PackageRef, bool)
}

type Printer

type Printer struct {
	// contains filtered or unexported fields
}

func (*Printer) Blank

func (p *Printer) Blank()

func (*Printer) Bytes

func (p *Printer) Bytes() []byte

func (*Printer) Dedent

func (p *Printer) Dedent()

func (*Printer) EnumTypeName

func (p *Printer) EnumTypeName(enum *onkir.Enum) string

func (*Printer) Indent

func (p *Printer) Indent()

func (*Printer) MessageTypeName

func (p *Printer) MessageTypeName(message *onkir.Message) string

func (*Printer) P

func (p *Printer) P(args ...any)

func (*Printer) Raw added in v0.25.1

func (p *Printer) Raw(source string)

Raw appends source text exactly as given, without indentation or a trailing newline.

func (*Printer) RustType

func (p *Printer) RustType(t *onkir.Type) string

Jump to

Keyboard shortcuts

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