Documentation ¶
Index ¶
- func As[T any](variant Any) T
- func ConvertTo(to reflect.Type, v any) any
- func Debug[T pointers.Generic[T, S], S pointers.Size](ptr T)
- func Marshal(value interface{}) ([]byte, error)
- func Proxy[T API](current Any, alloc func() (T, complex128)) (T, complex128)
- func UnmarshalAny(data []byte) (any, error)
- func UnmarshalSize(data []byte) (uintptr, error)
- func Use[T pointers.Generic[T, S], S pointers.Size](ptr T)
- type API
- type Any
- func (a Any) AABB() AABB.PositionSize
- func (a Any) Basis() Basis.XYZ
- func (a Any) Bool() bool
- func (a Any) Bytes() []byte
- func (a Any) Call(name string, args ...Any) Any
- func (a Any) Color() Color.RGBA
- func (a Any) Complex128() complex128
- func (a Any) Complex64() complex64
- func (a Any) Float32() float32
- func (a Any) Float64() float64
- func (a Any) Int() int
- func (a Any) Int16() int16
- func (a Any) Int32() int32
- func (a Any) Int64() int64
- func (a Any) Int8() int8
- func (a Any) Interface() interface{}
- func (a Any) Plane() Plane.NormalD
- func (a Any) Projection() Projection.XYZW
- func (a Any) Quaternion() Quaternion.IJKX
- func (a Any) RID() RID.Any
- func (a Any) Rect2() Rect2.PositionSize
- func (a Any) Rect2i() Rect2i.PositionSize
- func (a Any) String() string
- func (a Any) Transform2D() Transform2D.OriginXY
- func (a Any) Transform3D() Transform3D.BasisOrigin
- func (a Any) Type() Type
- func (a Any) Uint() uint
- func (a Any) Uint16() uint16
- func (a Any) Uint32() uint32
- func (a Any) Uint64() uint64
- func (a Any) Uint8() uint8
- func (a Any) Uintptr() uintptr
- func (a Any) Vector2() Vector2.XY
- func (a Any) Vector2i() Vector2i.XY
- func (a Any) Vector3() Vector3.XYZ
- func (a Any) Vector3i() Vector3i.XYZ
- func (a Any) Vector4() Vector4.XYZW
- func (a Any) Vector4i() Vector4i.XYZW
- type Getter
- type Loader
- type Operator
- type Packer
- type Setter
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertTo ¶
ConvertTo converts the given variant to the given type, using the Type values. This method is generous with how it handles types, it can automatically convert between array types, convert numeric Strings to int, and converting most things to String.
If the type conversion cannot be done, this method will return the default value for that type, for example converting [Rect2.PositionSize] to [Vector2.XY] will always return [Vector2.Zero]. This method will never show error messages as long as type is a valid Variant type.
func Proxy ¶
func Proxy[T API](current Any, alloc func() (T, complex128)) (T, complex128)
func UnmarshalAny ¶
UnmarshalAny a variant-encoded value from the byte slice.
func UnmarshalSize ¶
Decodes a size of a Variant from the bytes starting at offset. Requires at least 4 bytes of data starting at the offset, otherwise fails.
Types ¶
type API ¶
type API interface { Bool(complex128) bool Int(complex128) int64 Float(complex128) float64 Vector2(complex128) Vector2.XY Vector2i(complex128) Vector2i.XY Rect2(complex128) Rect2.PositionSize Rect2i(complex128) Rect2i.PositionSize Vector3(complex128) Vector3.XYZ Vector3i(complex128) Vector3i.XYZ Transform2D(complex128) Transform2D.OriginXY Vector4(complex128) Vector4.XYZW Vector4i(complex128) Vector4i.XYZW Plane(complex128) Plane.NormalD Quaternion(complex128) Quaternion.IJKX AABB(complex128) AABB.PositionSize Basis(complex128) Basis.XYZ Transform3D(complex128) Transform3D.BasisOrigin Projection(complex128) Projection.XYZW Color(complex128) Color.RGBA RID(complex128) RID.Any Interface(complex128) interface{} Bytes(complex128) []byte New(any) complex128 NewBool(bool) complex128 NewInt(int64) complex128 NewFloat(float64) complex128 NewVector2(Vector2.XY) complex128 NewVector2i(Vector2i.XY) complex128 NewRect2(Rect2.PositionSize) complex128 NewRect2i(Rect2i.PositionSize) complex128 NewVector3(Vector3.XYZ) complex128 NewVector3i(Vector3i.XYZ) complex128 NewTransform2D(Transform2D.OriginXY) complex128 NewVector4(Vector4.XYZW) complex128 NewVector4i(Vector4i.XYZW) complex128 NewPlane(Plane.NormalD) complex128 NewQuaternion(Quaternion.IJKX) complex128 NewAABB(AABB.PositionSize) complex128 NewBasis(Basis.XYZ) complex128 NewTransform3D(Transform3D.BasisOrigin) complex128 NewProjection(Projection.XYZW) complex128 NewRID(RID.Any) complex128 NewColor(Color.RGBA) complex128 NewBytes([]byte) complex128 Convert(complex128, reflect.Type) reflect.Value AssignableTo(complex128, reflect.Type) bool ConvertibleTo(complex128, reflect.Type) bool Calculate(complex128, Operator, complex128) Any Call(complex128, String.Readable, ...Any) Any Has(complex128, Any) bool Set(complex128, Any, Any) bool Get(complex128, Any) (Any, bool) Iter(complex128) iter.Seq2[Any, Any] Hash(complex128, int) uint32 Duplicate(complex128) Any Type(complex128) Type String(complex128) string KeepAlive(complex128) bool Free(complex128) }
type Any ¶
type Any struct {
// contains filtered or unexported fields
}
Any is like the standard [any] type except it can store the following types without allocating them on the heap:
- [bool]
- [int][int8][int16][int32][int64][uint][uint8][uint16][uint32][uint64][uintptr]
- [Float.X][float32][float64][complex64][complex128]
- [string][String][[]byte][[]int32][[]int64][[]float32][[]float64][[]string]
- [[]Vector2.XY][[]Vector3.XYZ][[]Color.RGBA][[]Vector4.XYZW]
- [Rect2.PositionSize][Rect2i.PositionSize][Plane.NormalD]
- [Vector2.XY][Vector2i.XY][Vector3.XYZ][Vector3i.XYZ][Vector4.XYZW][Vector4i.XYZW][Color.RGBA]
var Nil Any
Nil reference value.
func Implementation ¶
func Implementation(impl API, state complex128) Any
func (Any) AABB ¶
func (a Any) AABB() AABB.PositionSize
func (Any) Call ¶
Call attempts to call the given method on the given variant value with the given arguments.
func (Any) Complex128 ¶
func (a Any) Complex128() complex128
func (Any) Interface ¶
func (a Any) Interface() interface{}
Interface returns the value of the variant as an interface{}.
func (Any) Projection ¶
func (a Any) Projection() Projection.XYZW
func (Any) Quaternion ¶
func (a Any) Quaternion() Quaternion.IJKX
func (Any) Rect2 ¶
func (a Any) Rect2() Rect2.PositionSize
func (Any) Rect2i ¶
func (a Any) Rect2i() Rect2i.PositionSize
func (Any) Transform2D ¶
func (a Any) Transform2D() Transform2D.OriginXY
func (Any) Transform3D ¶
func (a Any) Transform3D() Transform3D.BasisOrigin
type Operator ¶
type Operator int
const ( OpEqual Operator = 0 // == OpNotEqual Operator = 1 // != OpLess Operator = 2 // < OpLessEqual Operator = 3 // <= OpGreater Operator = 4 // > OpGreaterEqual Operator = 5 // >= OpAdd Operator = 6 // + OpSubtract Operator = 7 // - OpMultiply Operator = 8 // * OpDivide Operator = 9 // / OpNegate Operator = 10 // - OpPositive Operator = 11 // + OpModule Operator = 12 // % OpPower Operator = 13 // ** OpShiftLeft Operator = 14 // << OpShiftRight Operator = 15 // >> OpBitAnd Operator = 16 // & OpBitOr Operator = 17 // | OpBitXor Operator = 18 // ^ OpBitNegate Operator = 19 // ~ OpAnd Operator = 20 // && OpOr Operator = 21 // || OpXor Operator = 22 // != OpNot Operator = 23 // ! OpIn Operator = 24 // [] )
type Type ¶
type Type int
const ( TypeNil Type = 0 TypeBool Type = 1 TypeInt Type = 2 TypeFloat Type = 3 TypeString Type = 4 TypeVector2 Type = 5 TypeVector2i Type = 6 TypeRect2 Type = 7 TypeRect2i Type = 8 TypeVector3 Type = 9 TypeVector3i Type = 10 TypeTransform2D Type = 11 TypeVector4 Type = 12 TypeVector4i Type = 13 TypePlane Type = 14 TypeQuaternion Type = 15 TypeAABB Type = 16 TypeBasis Type = 17 TypeTransform3D Type = 18 TypeProjection Type = 19 TypeColor Type = 20 TypeStringName Type = 21 TypeNodePath Type = 22 TypeRID Type = 23 TypeObject Type = 24 TypeCallable Type = 25 TypeSignal Type = 26 TypeDictionary Type = 27 TypeArray Type = 28 TypePackedByteArray Type = 29 TypePackedInt32Array Type = 30 TypePackedInt64Array Type = 31 TypePackedFloat32Array Type = 32 TypePackedFloat64Array Type = 33 TypePackedStringArray Type = 34 TypePackedVector2Array Type = 35 TypePackedVector3Array Type = 36 TypePackedColorArray Type = 37 TypePackedVector4Array Type = 38 )
Directories ¶
Path | Synopsis |
---|---|
Package AABB provides a 3D axis-aligned bounding box.
|
Package AABB provides a 3D axis-aligned bounding box. |
Package Array provides a data structure that holds a sequence of elements.
|
Package Array provides a data structure that holds a sequence of elements. |
Package Basis is a 3×3 matrix for representing 3D rotation and scale.
|
Package Basis is a 3×3 matrix for representing 3D rotation and scale. |
Package Callable provides generic methods for working with callable functions.
|
Package Callable provides generic methods for working with callable functions. |
Package Color provides a color represented in RGBA format.
|
Package Color provides a color represented in RGBA format. |
Package Dictionary provides a data structure that holds key-value pairs.
|
Package Dictionary provides a data structure that holds key-value pairs. |
Package Error provides generic or codes for use as error return values that do not allocate.
|
Package Error provides generic or codes for use as error return values that do not allocate. |
Package Float provides a generic math library for floating-point numbers.
|
Package Float provides a generic math library for floating-point numbers. |
Package Int provides generic methods for working with integers.
|
Package Int provides generic methods for working with integers. |
Package Object provides methods for working with Object instances.
|
Package Object provides methods for working with Object instances. |
Package Packed contains specific Array types that are more efficient and convenient to work with.
|
Package Packed contains specific Array types that are more efficient and convenient to work with. |
Package path provides methods and a type for working with slash-separated paths with selectors.
|
Package path provides methods and a type for working with slash-separated paths with selectors. |
Package Plane provides a plane in Hessian normal form.
|
Package Plane provides a plane in Hessian normal form. |
Package Projection provides a 4×4 matrix for 3D projective transformations.
|
Package Projection provides a 4×4 matrix for 3D projective transformations. |
Package Quaternion provides a unit quaternion used for representing 3D rotations.
|
Package Quaternion provides a unit quaternion used for representing 3D rotations. |
Package Rect2 provides a 2D axis-aligned bounding box using floating-point coordinates.
|
Package Rect2 provides a 2D axis-aligned bounding box using floating-point coordinates. |
Package Rect2i provides a 2D axis-aligned bounding box using integer coordinates.
|
Package Rect2i provides a 2D axis-aligned bounding box using integer coordinates. |
Package Signal provides a type representing an event stream or pub/sub message queue.
|
Package Signal provides a type representing an event stream or pub/sub message queue. |
Package String provides a generic string functions.
|
Package String provides a generic string functions. |
Package StringName provides unique strings.
|
Package StringName provides unique strings. |
Package Transform2D provides a 2×3 matrix representing a 2D transformation.
|
Package Transform2D provides a 2×3 matrix representing a 2D transformation. |
Package Transform3D a 3×4 matrix representing a 3D transformation.
|
Package Transform3D a 3×4 matrix representing a 3D transformation. |
Package Vector2 provides a 2D vector using floating-point coordinates.
|
Package Vector2 provides a 2D vector using floating-point coordinates. |
Package Vector2i provides a 2D vector using integer coordinates.
|
Package Vector2i provides a 2D vector using integer coordinates. |
Package Vector3 provides a 3D vector using floating-point coordinates.
|
Package Vector3 provides a 3D vector using floating-point coordinates. |
Package Vector3 provides a 3D vector using integer coordinates.
|
Package Vector3 provides a 3D vector using integer coordinates. |
Package Vector4 provides a 4D vector using integer coordinates.
|
Package Vector4 provides a 4D vector using integer coordinates. |
Package Vector4i provides a 4D vector using integer coordinates.
|
Package Vector4i provides a 4D vector using integer coordinates. |