1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
module FFI
class Struct[out P < AbstractMemory, unchecked out E]
type layout = Library::ffi_lib_type | singleton(StructLayout::Field) | [layout, Integer]
type ptr = Type::Mapped[
StructByReference[Struct[AbstractMemory, untyped], AbstractMemory],
AbstractMemory, instance, untyped
]
def self.ptr: (?untyped flags) -> ptr # https://github.com/ffi/ffi/issues/1073
alias self.by_ref self.ptr
def self.in: () -> ptr
def self.out: () -> ptr
def self.val: () -> StructByValue[singleton(Struct)]
alias self.by_value self.val
alias self.alloc_inout self.new
alias self.alloc_in self.new
alias self.alloc_out self.new
alias self.new_inout self.new
alias self.new_in self.new
alias self.new_out self.new
def self.auto_ptr: () -> Type::Mapped[
ManagedStructConverter[ManagedStruct[AutoPointer, untyped], AutoPointer],
Pointer, instance, untyped
]
def self.layout: (*layout | Integer) -> StructLayout
| (Hash[Symbol, layout]) -> StructLayout
def self.size=: (Integer size) -> Integer
def self?.alignment: () -> Integer
def self?.members: () -> Array[Symbol]
def self?.offset_of: (Symbol name) -> Integer
def self?.offsets: () -> Array[[Symbol, Integer]]
def self?.size: -> Integer
def initialize: (?P pointer, *layout args) -> void
def []: (Symbol field_name) -> E
def []=: (Symbol field_name, E value) -> E
alias align alignment
def clear: () -> self
def layout: () -> StructLayout
def null?: () -> bool
def order: (AbstractMemory::order_in order) -> Struct[P, E]
| () -> AbstractMemory::order_out
def pointer: () -> P
alias to_ptr pointer
def values: () -> Array[E]
class InlineArray[out P < AbstractMemory, unchecked out E]
include Enumerable[E]
include AbstractMemory::_Size
def initialize: (P memory, StructLayout::Field field) -> self
def []: (Integer index) -> E
def []=: (Integer index, E value) -> E
def each: () { (E) -> void } -> self
def to_a: () -> Array[E]
def to_ptr: () -> P
end
class ManagedStructConverter[S < ManagedStruct[P, untyped], P < AutoPointer] < StructByReference[S, P]
def initialize: ...
def from_native: (Pointer ptr, untyped ctx) -> S
end
end
class ManagedStruct[out P < AutoPointer, unchecked out E] < Struct[P, E]
def self.release: (AbstractMemory ptr) -> void
def initialize: (Pointer pointer) -> self
end
class Union[out P < AbstractMemory, unchecked out E] < Struct[P, E]
def self.builder: () -> StructLayoutBuilder
end
end
|