struct Novika::FFI::UnionView

Overview

Value-side representation of a union.

Defined in:

novika/ffi.cr

Instance Method Summary

Instance methods inherited from struct Novika::FFI::StructView

==(other : StructView) ==, [](id : String) [], []=(id : String, value : ForeignValue) []=, []?(id : String) []?, address(*args, **options)
address(*args, **options, &)
address
, has_field?(*args, **options)
has_field?(*args, **options, &)
has_field?
, hash(hasher) hash, layout : StructLayout layout, size size, to_form? : Form | Nil to_form?, to_s(io) to_s, unsafe_fetch(index : Int) unsafe_fetch, unsafe_put(index : Int, value : ForeignValue) unsafe_put

Constructor methods inherited from struct Novika::FFI::StructView

new(layout : Novika::FFI::StructLayout, handle : Pointer(Void)) new

Instance methods inherited from module Novika::FFI::ForeignValue

box : Pointer(Void) box, must_be_of(type : ForeignType) must_be_of, to_form? : Form | Nil to_form?, write_to!(base : Pointer(Void)) : Pointer(Void) write_to!

Instance Method Detail

def box : Pointer(Void) #
Description copied from module Novika::FFI::ForeignValue

Wraps this value in a void pointer.


def size #
Description copied from module Indexable(Novika::FFI::ForeignValue)

Returns the number of elements in this container.


def to_s(io) #

def unsafe_fetch(index : Int) #
Description copied from module Indexable(Novika::FFI::ForeignValue)

Returns the element at the given index, without doing any bounds check.

Indexable makes sure to invoke this method with index in 0...size, so converting negative indices to positive ones is not needed here.

Clients never invoke this method directly. Instead, they access elements with #[](index) and #[]?(index).

This method should only be directly invoked if you are absolutely sure the index is in bounds, to avoid a bounds check for a small boost of performance.


def unsafe_put(index : Int, value : ForeignValue) #
Description copied from module Indexable::Mutable(Novika::FFI::ForeignValue)

Sets the element at the given index to value, without doing any bounds check.

Indexable::Mutable makes sure to invoke this method with index in 0...size, so converting negative indices to positive ones is not needed here.

Clients never invoke this method directly. Instead, they modify elements with #[]=(index, value).

This method should only be directly invoked if you are absolutely sure the index is in bounds, to avoid a bounds check for a small boost of performance.


def write_to!(base : Pointer(Void)) : Pointer(Void) #
Description copied from module Novika::FFI::ForeignValue

Writes this value starting at the given base pointer. Returns the base pointer.