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
77
78
79
80
81
82
83
84
85
86
87
88
use crate::rubysys::{
class::MaybeAllocFunction,
types::{c_char, Id, Value},
};
#[cfg_attr(rutie_dllimport, link(name = "rutie_ruby"))]
extern "C" {
pub static rb_cStruct: Value;
}
#[cfg_attr(rutie_dllimport, link(name = "rutie_ruby"))]
extern "C" {
// VALUE
// rb_struct_alloc(VALUE klass, VALUE values)
pub fn rb_struct_alloc(klass: Value, values: Value) -> Value;
// VALUE
// rb_struct_aref(VALUE s, VALUE idx)
pub fn rb_struct_aref(object: Value, index: Value) -> Value;
// VALUE
// rb_struct_aset(VALUE s, VALUE idx, VALUE val)
pub fn rb_struct_aset(object: Value, index: Value, value: Value) -> Value;
// VALUE
// rb_struct_define(const char *name, ...)
//
// Member names are `const char *`, terminated by a null pointer.
pub fn rb_struct_define(name: *const c_char, ...) -> Value;
// VALUE
// rb_struct_define_under(VALUE outer, const char *name, ...)
pub fn rb_struct_define_under(outer: Value, name: *const c_char, ...) -> Value;
// VALUE
// rb_struct_getmember(VALUE obj, ID id)
pub fn rb_struct_getmember(object: Value, name: Id) -> Value;
// VALUE
// rb_struct_members(VALUE s)
pub fn rb_struct_members(object: Value) -> Value;
// VALUE
// rb_struct_new(VALUE klass, ...)
pub fn rb_struct_new(klass: Value, ...) -> Value;
// VALUE
// rb_struct_s_members(VALUE klass)
pub fn rb_struct_s_members(klass: Value) -> Value;
// VALUE
// rb_struct_size(VALUE s)
pub fn rb_struct_size(object: Value) -> Value;
// VALUE
// rb_data_define(VALUE super, ...)
//
// An anonymous `Data` class (`Data.define`) under `super` (a `Data`
// class, or 0 for `Data`). Member names are `const char *`, terminated
// by a null pointer; raises `ArgumentError` for a duplicate.
pub fn rb_data_define(superclass: Value, ...) -> Value;
}
#[cfg_attr(rutie_dllimport, link(name = "rutie_ruby"))]
extern "C" {
// VALUE
// rb_struct_alloc_noinit(VALUE klass)
//
// An instance with every member `nil`; `initialize` is not called.
pub fn rb_struct_alloc_noinit(klass: Value) -> Value;
// VALUE
// rb_struct_define_without_accessor(const char *name, VALUE super,
// rb_alloc_func_t func, ...)
//
// Member names are `const char *`, terminated by a null pointer. No
// accessor methods are defined; a null `name` makes an anonymous class.
pub fn rb_struct_define_without_accessor(
name: *const c_char,
superclass: Value,
alloc: MaybeAllocFunction,
...
) -> Value;
// VALUE
// rb_struct_define_without_accessor_under(VALUE outer, const char *class_name,
// VALUE super, rb_alloc_func_t alloc, ...)
pub fn rb_struct_define_without_accessor_under(
outer: Value,
name: *const c_char,
superclass: Value,
alloc: MaybeAllocFunction,
...
) -> Value;
// VALUE
// rb_struct_initialize(VALUE self, VALUE values)
//
// `Struct#initialize` with the members' values in the `Array` `values`.
pub fn rb_struct_initialize(object: Value, values: Value) -> Value;
}