Candiru::StructScaffolding
Inherits Candiru::ValueClass < Candiru::IValueClassType < Reference < Object
Struct scaffolding helps to describe the scaffolding of structs.
This implementation treats structs as arrays with (possibly) different type for each element.
point = StructScaffolding[Int32, Int32]
instance = point.new do |b|
b << 123
b << 456
end
instance.pointer # Pointer(Void)
Constructors
Instance methods
Appends a pointer to another struct (could be itself, e.g. in a linked list), as described by scaffolding.
Casts pointer, a return value hole from FFI, to this type, and returns its value.
Yields a StructBuilder which facilitates the creation
of an instance of this struct. Returns the resulting
struct instance.
Makes a struct instance from pointer. Unsafe: does not verify whether the contents of pointer are valid for use under this struct scaffolding.
Returns the FFI type corresponding to this value class.
Int32.to_ffi # FFI::Type.sint32
Macros
A shorthand for initializing struct scaffolding.
StructScaffolding[Int64, Int64]
# Is the same as writing:
scaffolding = StructScaffolding.new
scaffolding << Int64
scaffolding << Int64