genrust

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const HeaderComment = "// Code generated by tl2gen; DO NOT EDIT."

Variables

This section is empty.

Functions

func Generate

func Generate(kernel *pure.Kernel, options *puregen.Options) error

func ToUpperFirst

func ToUpperFirst(str string) string

func TypeRWWrapperLessGlobal

func TypeRWWrapperLessGlobal(a *TypeRWWrapper, b *TypeRWWrapper) int

func TypeRWWrapperLessLocal

func TypeRWWrapperLessLocal(a *TypeRWWrapper, b *TypeRWWrapper) int

Types

type DirectImports

type DirectImports struct {
}

for tracking imports.

type Field

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

func (*Field) Bare

func (f *Field) Bare() bool

func (*Field) BitNumber

func (f *Field) BitNumber() uint32

func (*Field) EnsureRecursive

func (f *Field) EnsureRecursive(bytesVersion bool, directImports *DirectImports) string

func (*Field) FieldAccess

func (f *Field) FieldAccess(val string, bytesVersion bool, directImports *DirectImports) (string, bool)

func (*Field) FieldMask

func (f *Field) FieldMask() *pure.ActualNatArg

func (*Field) HasNatArguments

func (f *Field) HasNatArguments() bool

func (*Field) IsAffectedByExternalFieldMask

func (f *Field) IsAffectedByExternalFieldMask() bool

func (*Field) IsAffectedByLocalFieldMask

func (f *Field) IsAffectedByLocalFieldMask() bool

func (*Field) IsBit

func (f *Field) IsBit() bool

func (*Field) IsTL2Omitted

func (f *Field) IsTL2Omitted() bool

do not generate fields, but affect block position and skip during reading TL1: never TL2: _:X

func (*Field) IsTypeDependsFromLocalFields

func (f *Field) IsTypeDependsFromLocalFields() bool

func (*Field) MaskTL2Bit

func (f *Field) MaskTL2Bit() *int

func (*Field) NatArgs

func (f *Field) NatArgs() []pure.ActualNatArg

func (*Field) OriginalName

func (f *Field) OriginalName() string

func (*Field) TL2MaskForOP

func (f *Field) TL2MaskForOP(op string) string

type Namespace

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

type TypeRW

type TypeRW interface {
	FillRecursiveChildren(visitedNodes map[*TypeRWWrapper]int, generic bool)
	ContainsUnion(visitedNodes map[*TypeRWWrapper]bool) bool

	BeforeCodeGenerationStep1() // during first phase, struct fields recursive bit is set
	BeforeCodeGenerationStep2() // during second phase, union fields recursive bit is set

	GenerateCode(bytesVersion bool, directImports *DirectImports) string

	TypeRWTL2
	// contains filtered or unexported methods
}

type TypeRWBool

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

func (*TypeRWBool) BeforeCodeGenerationStep1

func (trw *TypeRWBool) BeforeCodeGenerationStep1()

func (*TypeRWBool) BeforeCodeGenerationStep2

func (trw *TypeRWBool) BeforeCodeGenerationStep2()

func (*TypeRWBool) ContainsUnion

func (trw *TypeRWBool) ContainsUnion(visitedNodes map[*TypeRWWrapper]bool) bool

func (*TypeRWBool) FillRecursiveChildren

func (trw *TypeRWBool) FillRecursiveChildren(visitedNodes map[*TypeRWWrapper]int, generic bool)

func (*TypeRWBool) GenerateCode

func (trw *TypeRWBool) GenerateCode(bytesVersion bool, directImports *DirectImports) string

type TypeRWBrackets

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

func (*TypeRWBrackets) BeforeCodeGenerationStep1

func (trw *TypeRWBrackets) BeforeCodeGenerationStep1()

func (*TypeRWBrackets) BeforeCodeGenerationStep2

func (trw *TypeRWBrackets) BeforeCodeGenerationStep2()

func (*TypeRWBrackets) ContainsUnion

func (trw *TypeRWBrackets) ContainsUnion(visitedNodes map[*TypeRWWrapper]bool) bool

func (*TypeRWBrackets) FillRecursiveChildren

func (trw *TypeRWBrackets) FillRecursiveChildren(visitedNodes map[*TypeRWWrapper]int, generic bool)

func (*TypeRWBrackets) GenerateCode

func (trw *TypeRWBrackets) GenerateCode(bytesVersion bool, directImports *DirectImports) string

type TypeRWDict

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

func (*TypeRWDict) BeforeCodeGenerationStep1

func (trw *TypeRWDict) BeforeCodeGenerationStep1()

func (*TypeRWDict) BeforeCodeGenerationStep2

func (trw *TypeRWDict) BeforeCodeGenerationStep2()

func (*TypeRWDict) ContainsUnion

func (trw *TypeRWDict) ContainsUnion(visitedNodes map[*TypeRWWrapper]bool) bool

func (*TypeRWDict) FillRecursiveChildren

func (trw *TypeRWDict) FillRecursiveChildren(visitedNodes map[*TypeRWWrapper]int, generic bool)

func (*TypeRWDict) GenerateCode

func (trw *TypeRWDict) GenerateCode(bytesVersion bool, directImports *DirectImports) string

type TypeRWMaybe

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

func (*TypeRWMaybe) BeforeCodeGenerationStep1

func (trw *TypeRWMaybe) BeforeCodeGenerationStep1()

func (*TypeRWMaybe) BeforeCodeGenerationStep2

func (trw *TypeRWMaybe) BeforeCodeGenerationStep2()

func (*TypeRWMaybe) ContainsUnion

func (trw *TypeRWMaybe) ContainsUnion(visitedNodes map[*TypeRWWrapper]bool) bool

func (*TypeRWMaybe) FillRecursiveChildren

func (trw *TypeRWMaybe) FillRecursiveChildren(visitedNodes map[*TypeRWWrapper]int, generic bool)

func (*TypeRWMaybe) GenerateCode

func (trw *TypeRWMaybe) GenerateCode(bytesVersion bool, directImports *DirectImports) string

type TypeRWPrimitive

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

func (*TypeRWPrimitive) BeforeCodeGenerationStep1

func (trw *TypeRWPrimitive) BeforeCodeGenerationStep1()

func (*TypeRWPrimitive) BeforeCodeGenerationStep2

func (trw *TypeRWPrimitive) BeforeCodeGenerationStep2()

func (*TypeRWPrimitive) ContainsUnion

func (trw *TypeRWPrimitive) ContainsUnion(visitedNodes map[*TypeRWWrapper]bool) bool

func (*TypeRWPrimitive) FillRecursiveChildren

func (trw *TypeRWPrimitive) FillRecursiveChildren(visitedNodes map[*TypeRWWrapper]int, generic bool)

func (*TypeRWPrimitive) GenerateCode

func (trw *TypeRWPrimitive) GenerateCode(byteVersion bool, directImports *DirectImports) string

type TypeRWStruct

type TypeRWStruct struct {
	Fields []Field

	ResultType    *TypeRWWrapper
	ResultNatArgs []pure.ActualNatArg
	// contains filtered or unexported fields
}

func (*TypeRWStruct) AllAffectedFieldMasks

func (trw *TypeRWStruct) AllAffectedFieldMasks(f Field) (nats []Field, bits []uint32)

AllAffectedFieldMasks f must be from trw.Fields

func (*TypeRWStruct) AllNewTL2Masks

func (trw *TypeRWStruct) AllNewTL2Masks() []string

func (*TypeRWStruct) BeforeCodeGenerationStep1

func (trw *TypeRWStruct) BeforeCodeGenerationStep1()

func (*TypeRWStruct) BeforeCodeGenerationStep2

func (trw *TypeRWStruct) BeforeCodeGenerationStep2()

func (*TypeRWStruct) ContainsUnion

func (trw *TypeRWStruct) ContainsUnion(visitedNodes map[*TypeRWWrapper]bool) bool

func (*TypeRWStruct) FillRecursiveChildren

func (trw *TypeRWStruct) FillRecursiveChildren(visitedNodes map[*TypeRWWrapper]int, generic bool)

func (*TypeRWStruct) GenerateCode

func (trw *TypeRWStruct) GenerateCode(bytesVersion bool, directImports *DirectImports) string

TODO - move to separate file

func (*TypeRWStruct) GetAllLocallyAffectedByTrueTypeFieldMasks

func (trw *TypeRWStruct) GetAllLocallyAffectedByTrueTypeFieldMasks() []Field

func (*TypeRWStruct) GetAllLocallyAffectedFieldMasks

func (trw *TypeRWStruct) GetAllLocallyAffectedFieldMasks() []Field

type TypeRWTL2

type TypeRWTL2 interface {
	// contains filtered or unexported methods
}

type TypeRWUnion

type TypeRWUnion struct {
	Fields []Variant
	IsEnum bool
	// contains filtered or unexported fields
}

func (*TypeRWUnion) BeforeCodeGenerationStep1

func (trw *TypeRWUnion) BeforeCodeGenerationStep1()

func (*TypeRWUnion) BeforeCodeGenerationStep2

func (trw *TypeRWUnion) BeforeCodeGenerationStep2()

func (*TypeRWUnion) ContainsUnion

func (trw *TypeRWUnion) ContainsUnion(visitedNodes map[*TypeRWWrapper]bool) bool

func (*TypeRWUnion) ElementNatArgs

func (trw *TypeRWUnion) ElementNatArgs() []pure.ActualNatArg

func (*TypeRWUnion) FillRecursiveChildren

func (trw *TypeRWUnion) FillRecursiveChildren(visitedNodes map[*TypeRWWrapper]int, generic bool)

func (*TypeRWUnion) GenerateCode

func (trw *TypeRWUnion) GenerateCode(bytesVersion bool, directImports *DirectImports) string

TODO - move to separate file

func (*TypeRWUnion) HasShortFieldCollision

func (trw *TypeRWUnion) HasShortFieldCollision(wr *TypeRWWrapper) bool

TODO - remove with long adapters

type TypeRWWrapper

type TypeRWWrapper struct {
	WrLong        *TypeRWWrapper // long transitioning code
	WrWithoutLong *TypeRWWrapper // long transitioning code
	// contains filtered or unexported fields
}

func (*TypeRWWrapper) AnnotationsMask

func (w *TypeRWWrapper) AnnotationsMask() uint32

func (*TypeRWWrapper) CalculateLayoutCall

func (w *TypeRWWrapper) CalculateLayoutCall(
	directImports *DirectImports,
	bytesVersion bool,
	targetSizes string,
	targetObject string,
	zeroIfEmpty bool,

	refObject bool,
) string

func (*TypeRWWrapper) DoArgumentsContainUnionTypes

func (w *TypeRWWrapper) DoArgumentsContainUnionTypes() bool

func (*TypeRWWrapper) DoesReturnTypeContainUnionTypes

func (w *TypeRWWrapper) DoesReturnTypeContainUnionTypes() bool

func (*TypeRWWrapper) FileName

func (wr *TypeRWWrapper) FileName() string

func (*TypeRWWrapper) FillRecursiveChildren

func (w *TypeRWWrapper) FillRecursiveChildren(visitedNodes map[*TypeRWWrapper]bool)

func (*TypeRWWrapper) HasAnnotation

func (w *TypeRWWrapper) HasAnnotation(str string) bool

func (*TypeRWWrapper) HasFetcher

func (w *TypeRWWrapper) HasFetcher() bool

func (*TypeRWWrapper) HasTL2

func (wr *TypeRWWrapper) HasTL2() bool

func (*TypeRWWrapper) IsFunction

func (w *TypeRWWrapper) IsFunction() bool

func (*TypeRWWrapper) IsTrueType

func (w *TypeRWWrapper) IsTrueType() bool

func (*TypeRWWrapper) MarkHasBytesVersion

func (w *TypeRWWrapper) MarkHasBytesVersion(visitedNodes map[*TypeRWWrapper]bool) bool

func (*TypeRWWrapper) MarkHasRepairMasks

func (w *TypeRWWrapper) MarkHasRepairMasks(visitedNodes map[*TypeRWWrapper]bool) bool

func (*TypeRWWrapper) MarkWantsBytesVersion

func (w *TypeRWWrapper) MarkWantsBytesVersion(visitedNodes map[*TypeRWWrapper]bool)

func (*TypeRWWrapper) MarkWriteHasError

func (w *TypeRWWrapper) MarkWriteHasError(visitedNodes map[*TypeRWWrapper]bool) bool

func (*TypeRWWrapper) Namespace

func (wr *TypeRWWrapper) Namespace() string

func (*TypeRWWrapper) NatParams

func (wr *TypeRWWrapper) NatParams() []string

func (*TypeRWWrapper) OriginTL2

func (wr *TypeRWWrapper) OriginTL2() bool

func (*TypeRWWrapper) ReadTL2Call

func (w *TypeRWWrapper) ReadTL2Call(
	directImports *DirectImports,
	bytesVersion bool,
	targetBytes string,
	targetObject string,
	canDependOnLocalBit bool,

	refObject bool,
) string

func (*TypeRWWrapper) ShouldWriteEnumElementAlias

func (w *TypeRWWrapper) ShouldWriteEnumElementAlias() bool

func (*TypeRWWrapper) ShouldWriteTypeAlias

func (w *TypeRWWrapper) ShouldWriteTypeAlias() bool

func (*TypeRWWrapper) SkipTL2Call

func (w *TypeRWWrapper) SkipTL2Call(
	directImports *DirectImports,
	bytesVersion bool,
	targetBytes string,
	canDependOnLocalBit bool,

	refObject bool,
) string

func (*TypeRWWrapper) TLName

func (wr *TypeRWWrapper) TLName() tlast.TL2TypeName

func (*TypeRWWrapper) TLTag

func (wr *TypeRWWrapper) TLTag() uint32

func (*TypeRWWrapper) TypeJSON2ReadingCode

func (w *TypeRWWrapper) TypeJSON2ReadingCode(bytesVersion bool, directImports *DirectImports, jvalue string, val string, natArgs []string, ref bool) string

func (*TypeRWWrapper) TypeJSONEmptyCondition

func (w *TypeRWWrapper) TypeJSONEmptyCondition(bytesVersion bool, val string, ref bool) string

func (*TypeRWWrapper) TypeJSONWritingCode

func (w *TypeRWWrapper) TypeJSONWritingCode(bytesVersion bool, directImports *DirectImports, val string, natArgs []string, ref bool, needError bool) string

func (*TypeRWWrapper) TypeRandomCode

func (w *TypeRWWrapper) TypeRandomCode(bytesVersion bool, directImports *DirectImports, val string, natArgs []string, ref bool) string

func (*TypeRWWrapper) TypeReadingCode

func (w *TypeRWWrapper) TypeReadingCode(cc *codecreator.RustCodeCreator, bytesVersion bool, directImports *DirectImports, val string, bare bool, natArgs []string, ref bool)

func (*TypeRWWrapper) TypeRepairMasksCode

func (w *TypeRWWrapper) TypeRepairMasksCode(bytesVersion bool, directImports *DirectImports, val string, natArgs []string, ref bool) string

func (*TypeRWWrapper) TypeResettingCode

func (w *TypeRWWrapper) TypeResettingCode(cc *codecreator.RustCodeCreator, bytesVersion bool, directImports *DirectImports, val string, ref bool)

func (*TypeRWWrapper) TypeString2

func (w *TypeRWWrapper) TypeString2(bytesVersion bool, directImports *DirectImports, isLocal bool, skipAlias bool) string

func (*TypeRWWrapper) TypeWritingCode

func (w *TypeRWWrapper) TypeWritingCode(bytesVersion bool, directImports *DirectImports, val string, bare bool, natArgs []string, ref bool, last bool, needError bool) string

func (*TypeRWWrapper) UnionParent

func (wr *TypeRWWrapper) UnionParent() *TypeRWUnion

func (*TypeRWWrapper) WriteTL2Call

func (w *TypeRWWrapper) WriteTL2Call(
	directImports *DirectImports,
	bytesVersion bool,
	targetSizes string,
	targetBytes string,
	targetObject string,
	zeroIfEmpty bool,

	refObject bool,
) string

type Variant

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

func (*Variant) EnsureRecursive

func (f *Variant) EnsureRecursive(bytesVersion bool, directImports *DirectImports) string

Jump to

Keyboard shortcuts

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