testutils

package
v1.20.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Code generated by mkunion. DO NOT EDIT.

Code generated by mkunion. DO NOT EDIT.

Code generated by mkunion. DO NOT EDIT.

Code generated by mkunion. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func A1Shape

func A1Shape() shape.Shape

func A1ToJSON

func A1ToJSON(x *A1) ([]byte, error)

func AlphabetSchemaDef

func AlphabetSchemaDef() *schema.UnionVariants[Alphabet]

func AlphabetShape

func AlphabetShape() shape.Shape

mkunion-extension:shape

func AlphabetToJSON

func AlphabetToJSON(x Alphabet) ([]byte, error)

func B2Shape

func B2Shape() shape.Shape

func B2ToJSON

func B2ToJSON(x *B2) ([]byte, error)

func BranchShape

func BranchShape() shape.Shape

func BranchToJSON

func BranchToJSON(x *Branch) ([]byte, error)

func C3Shape

func C3Shape() shape.Shape

func C3ToJSON

func C3ToJSON(x *C3) ([]byte, error)

func KShape

func KShape() shape.Shape

func KToJSON

func KToJSON(x *K) ([]byte, error)

func LeafShape

func LeafShape() shape.Shape

func LeafToJSON

func LeafToJSON(x *Leaf) ([]byte, error)

func MatchAlphabet

func MatchAlphabet[TOut any](
	x Alphabet,
	f1 func(x *A1) TOut,
	f2 func(x *B2) TOut,
	f3 func(x *C3) TOut,
	df func(x Alphabet) TOut,
) TOut

func MatchAlphabetNumberTupleR0

func MatchAlphabetNumberTupleR0[T0 Alphabet, T1 Number](
	t0 T0,
	t1 T1,
	f0 func(x0 *A1, x1 *N0),
	f1 func(x0 *C3, x1 any),
	f2 func(x0 any, x1 any),
)

func MatchAlphabetNumberTupleR1

func MatchAlphabetNumberTupleR1[T0 Alphabet, T1 Number, TOut1 any](
	t0 T0,
	t1 T1,
	f0 func(x0 *A1, x1 *N0) TOut1,
	f1 func(x0 *C3, x1 any) TOut1,
	f2 func(x0 any, x1 any) TOut1,
) TOut1

func MatchAlphabetNumberTupleR2

func MatchAlphabetNumberTupleR2[T0 Alphabet, T1 Number, TOut1 any, TOut2 any](
	t0 T0,
	t1 T1,
	f0 func(x0 *A1, x1 *N0) (TOut1, TOut2),
	f1 func(x0 *C3, x1 any) (TOut1, TOut2),
	f2 func(x0 any, x1 any) (TOut1, TOut2),
) (TOut1, TOut2)

func MatchAlphabetNumberTupleR3

func MatchAlphabetNumberTupleR3[T0 Alphabet, T1 Number, TOut1 any, TOut2 any, TOut3 any](
	t0 T0,
	t1 T1,
	f0 func(x0 *A1, x1 *N0) (TOut1, TOut2, TOut3),
	f1 func(x0 *C3, x1 any) (TOut1, TOut2, TOut3),
	f2 func(x0 any, x1 any) (TOut1, TOut2, TOut3),
) (TOut1, TOut2, TOut3)

func MatchAlphabetR2

func MatchAlphabetR2[TOut1, TOut2 any](
	x Alphabet,
	f1 func(x *A1) (TOut1, TOut2),
	f2 func(x *B2) (TOut1, TOut2),
	f3 func(x *C3) (TOut1, TOut2),
	df func(x Alphabet) (TOut1, TOut2),
) (TOut1, TOut2)

func MatchNumber

func MatchNumber[TOut any](
	x Number,
	f1 func(x *N0) TOut,
	f2 func(x *N1) TOut,
	df func(x Number) TOut,
) TOut

func MatchNumberR2

func MatchNumberR2[TOut1, TOut2 any](
	x Number,
	f1 func(x *N0) (TOut1, TOut2),
	f2 func(x *N1) (TOut1, TOut2),
	df func(x Number) (TOut1, TOut2),
) (TOut1, TOut2)

func MatchTree

func MatchTree[TOut any](
	x Tree,
	f1 func(x *Branch) TOut,
	f2 func(x *Leaf) TOut,
	f3 func(x *K) TOut,
	f4 func(x *P) TOut,
	df func(x Tree) TOut,
) TOut

func MatchTreeR2

func MatchTreeR2[TOut1, TOut2 any](
	x Tree,
	f1 func(x *Branch) (TOut1, TOut2),
	f2 func(x *Leaf) (TOut1, TOut2),
	f3 func(x *K) (TOut1, TOut2),
	f4 func(x *P) (TOut1, TOut2),
	df func(x Tree) (TOut1, TOut2),
) (TOut1, TOut2)

func MustMatchAlphabet

func MustMatchAlphabet[TOut any](
	x Alphabet,
	f1 func(x *A1) TOut,
	f2 func(x *B2) TOut,
	f3 func(x *C3) TOut,
) TOut

func MustMatchAlphabetR0

func MustMatchAlphabetR0(
	x Alphabet,
	f1 func(x *A1),
	f2 func(x *B2),
	f3 func(x *C3),
)

func MustMatchAlphabetR2

func MustMatchAlphabetR2[TOut1, TOut2 any](
	x Alphabet,
	f1 func(x *A1) (TOut1, TOut2),
	f2 func(x *B2) (TOut1, TOut2),
	f3 func(x *C3) (TOut1, TOut2),
) (TOut1, TOut2)

func MustMatchNumber

func MustMatchNumber[TOut any](
	x Number,
	f1 func(x *N0) TOut,
	f2 func(x *N1) TOut,
) TOut

func MustMatchNumberR0

func MustMatchNumberR0(
	x Number,
	f1 func(x *N0),
	f2 func(x *N1),
)

func MustMatchNumberR2

func MustMatchNumberR2[TOut1, TOut2 any](
	x Number,
	f1 func(x *N0) (TOut1, TOut2),
	f2 func(x *N1) (TOut1, TOut2),
) (TOut1, TOut2)

func MustMatchTree

func MustMatchTree[TOut any](
	x Tree,
	f1 func(x *Branch) TOut,
	f2 func(x *Leaf) TOut,
	f3 func(x *K) TOut,
	f4 func(x *P) TOut,
) TOut

func MustMatchTreeR0

func MustMatchTreeR0(
	x Tree,
	f1 func(x *Branch),
	f2 func(x *Leaf),
	f3 func(x *K),
	f4 func(x *P),
)

func MustMatchTreeR2

func MustMatchTreeR2[TOut1, TOut2 any](
	x Tree,
	f1 func(x *Branch) (TOut1, TOut2),
	f2 func(x *Leaf) (TOut1, TOut2),
	f3 func(x *K) (TOut1, TOut2),
	f4 func(x *P) (TOut1, TOut2),
) (TOut1, TOut2)

func N0Shape

func N0Shape() shape.Shape

func N0ToJSON

func N0ToJSON(x *N0) ([]byte, error)

func N1Shape

func N1Shape() shape.Shape

func N1ToJSON

func N1ToJSON(x *N1) ([]byte, error)

func NumberSchemaDef

func NumberSchemaDef() *schema.UnionVariants[Number]

func NumberShape

func NumberShape() shape.Shape

mkunion-extension:shape

func NumberToJSON

func NumberToJSON(x Number) ([]byte, error)

func PShape added in v1.20.2

func PShape() shape.Shape

func PToJSON added in v1.20.2

func PToJSON(x *P) ([]byte, error)

func TreeSchemaDef

func TreeSchemaDef() *schema.UnionVariants[Tree]

func TreeShape

func TreeShape() shape.Shape

mkunion-extension:shape

func TreeToJSON

func TreeToJSON(x Tree) ([]byte, error)

Types

type A1

type A1 struct{}

func A1FromJSON

func A1FromJSON(x []byte) (*A1, error)

func (*A1) AcceptAlphabet

func (r *A1) AcceptAlphabet(v AlphabetVisitor) any

func (*A1) MarshalJSON

func (self *A1) MarshalJSON() ([]byte, error)

func (*A1) UnmarshalJSON

func (self *A1) UnmarshalJSON(x []byte) error

type Alphabet

type Alphabet interface {
	AcceptAlphabet(g AlphabetVisitor) any
}

func AlphabetFromJSON

func AlphabetFromJSON(x []byte) (Alphabet, error)

type AlphabetUnionJSON

type AlphabetUnionJSON struct {
	Type string          `json:"$type,omitempty"`
	A1   json.RawMessage `json:"testutils.A1,omitempty"`
	B2   json.RawMessage `json:"testutils.B2,omitempty"`
	C3   json.RawMessage `json:"testutils.C3,omitempty"`
}

mkunion-extension:json

type AlphabetVisitor

type AlphabetVisitor interface {
	VisitA1(v *A1) any
	VisitB2(v *B2) any
	VisitC3(v *C3) any
}

type B2

type B2 struct{}

func B2FromJSON

func B2FromJSON(x []byte) (*B2, error)

func (*B2) AcceptAlphabet

func (r *B2) AcceptAlphabet(v AlphabetVisitor) any

func (*B2) MarshalJSON

func (self *B2) MarshalJSON() ([]byte, error)

func (*B2) UnmarshalJSON

func (self *B2) UnmarshalJSON(x []byte) error

type Branch

type Branch struct {
	Lit  Tree
	List []Tree
	Map  map[string]Tree
}

func BranchFromJSON

func BranchFromJSON(x []byte) (*Branch, error)

func (*Branch) AcceptTree

func (r *Branch) AcceptTree(v TreeVisitor) any

func (*Branch) MarshalJSON

func (self *Branch) MarshalJSON() ([]byte, error)

func (*Branch) UnmarshalJSON

func (self *Branch) UnmarshalJSON(x []byte) error

type C3

type C3 struct{}

func C3FromJSON

func C3FromJSON(x []byte) (*C3, error)

func (*C3) AcceptAlphabet

func (r *C3) AcceptAlphabet(v AlphabetVisitor) any

func (*C3) MarshalJSON

func (self *C3) MarshalJSON() ([]byte, error)

func (*C3) UnmarshalJSON

func (self *C3) UnmarshalJSON(x []byte) error

type K

type K string

func KFromJSON

func KFromJSON(x []byte) (*K, error)

func (*K) AcceptTree

func (r *K) AcceptTree(v TreeVisitor) any

type Leaf

type Leaf struct{ Value int64 }

func LeafFromJSON

func LeafFromJSON(x []byte) (*Leaf, error)

func (*Leaf) AcceptTree

func (r *Leaf) AcceptTree(v TreeVisitor) any

func (*Leaf) MarshalJSON

func (self *Leaf) MarshalJSON() ([]byte, error)

func (*Leaf) UnmarshalJSON

func (self *Leaf) UnmarshalJSON(x []byte) error

type ListOf added in v1.20.2

type ListOf[T any] struct{}

type ListOf2 added in v1.20.2

type ListOf2[T1, T2 any] struct{}

type MatchAlphabetNumberTuple

type MatchAlphabetNumberTuple[T0 Alphabet, T1 Number] interface {
	Match1(x *A1, y *N0)
	Match2(x *C3, y any)
	Match3(x, y any)
}

type N0

type N0 struct{}

func N0FromJSON

func N0FromJSON(x []byte) (*N0, error)

func (*N0) AcceptNumber

func (r *N0) AcceptNumber(v NumberVisitor) any

func (*N0) MarshalJSON

func (self *N0) MarshalJSON() ([]byte, error)

func (*N0) UnmarshalJSON

func (self *N0) UnmarshalJSON(x []byte) error

type N1

type N1 struct{}

func N1FromJSON

func N1FromJSON(x []byte) (*N1, error)

func (*N1) AcceptNumber

func (r *N1) AcceptNumber(v NumberVisitor) any

func (*N1) MarshalJSON

func (self *N1) MarshalJSON() ([]byte, error)

func (*N1) UnmarshalJSON

func (self *N1) UnmarshalJSON(x []byte) error

type Number

type Number interface {
	AcceptNumber(g NumberVisitor) any
}

func NumberFromJSON

func NumberFromJSON(x []byte) (Number, error)

type NumberUnionJSON

type NumberUnionJSON struct {
	Type string          `json:"$type,omitempty"`
	N0   json.RawMessage `json:"testutils.N0,omitempty"`
	N1   json.RawMessage `json:"testutils.N1,omitempty"`
}

mkunion-extension:json

type NumberVisitor

type NumberVisitor interface {
	VisitN0(v *N0) any
	VisitN1(v *N1) any
}

type P added in v1.20.2

func PFromJSON added in v1.20.2

func PFromJSON(x []byte) (*P, error)

func (*P) AcceptTree added in v1.20.2

func (r *P) AcceptTree(v TreeVisitor) any

type Tree

type Tree interface {
	AcceptTree(g TreeVisitor) any
}

func TreeFromJSON

func TreeFromJSON(x []byte) (Tree, error)

type TreeUnionJSON

type TreeUnionJSON struct {
	Type   string          `json:"$type,omitempty"`
	Branch json.RawMessage `json:"testutils.Branch,omitempty"`
	Leaf   json.RawMessage `json:"testutils.Leaf,omitempty"`
	K      json.RawMessage `json:"testutils.K,omitempty"`
	P      json.RawMessage `json:"testutils.P,omitempty"`
}

mkunion-extension:json

type TreeVisitor

type TreeVisitor interface {
	VisitBranch(v *Branch) any
	VisitLeaf(v *Leaf) any
	VisitK(v *K) any
	VisitP(v *P) any
}

Jump to

Keyboard shortcuts

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