Marshal

gdext.internal.engine.Marshal
object Marshal

Compile-time marshalling for engine method ptrcalls.

ptrcall passes each argument as a pointer to its native representation (an int64, a double, a Vector2's 8 bytes, an object pointer, ...) and writes the return value's native representation into a caller-provided buffer.

Every method here is inline and dispatches on the static type with erasedValue, so a call site expands to straight-line code for its exact types: no typeclass instances, no boxing of primitives or Ptr-backed opaque types, no heap allocation. Argument and return buffers live on the stack of the (non-inline) calling method.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Marshal.type

Members list

Value members

Concrete methods

inline def read[R](b: Ptr[Byte]): R

Read a ptrcall return value of type R out of b. Owned engine values in the buffer (a String's reference, a StringName's reference) are consumed: a String is decoded and destroyed; a StringName is interned through StringNames.adopt, so its storage stays valid for the process.

Read a ptrcall return value of type R out of b. Owned engine values in the buffer (a String's reference, a StringName's reference) are consumed: a String is decoded and destroyed; a StringName is interned through StringNames.adopt, so its storage stays valid for the process.

Attributes

inline def release[A](b: Ptr[Byte]): Unit

Destroy whatever write built in b once the call has returned.

Destroy whatever write built in b once the call has returned.

Attributes

inline def size[A]: Int

Bytes needed for A's native representation. Object returns are read as the pointer's address (Long), never as a Ptr, so no box is made.

Bytes needed for A's native representation. Object returns are read as the pointer's address (Long), never as a Ptr, so no box is made.

Attributes

inline def write[A](inline v: A, b: Ptr[Byte]): Unit

Lay v down as a ptrcall argument in b (size bytes). A String argument builds a temporary Godot String that release destroys after the call; every other kind is a plain copy.

Lay v down as a ptrcall argument in b (size bytes). A String argument builds a temporary Godot String that release destroys after the call; every other kind is a plain copy.

Attributes