Ruby
3.4.0dev (2024-12-06 revision 892c46283a5ea4179500d951c9d4866c0051f27b)
|
Routines to manipulate struct RStruct. More...
#include "ruby/internal/attr/artificial.h"
#include "ruby/internal/dllexport.h"
#include "ruby/internal/value.h"
#include "ruby/internal/value_type.h"
#include "ruby/internal/arithmetic/long.h"
#include "ruby/internal/arithmetic/int.h"
#include "ruby/backward.h"
Go to the source code of this file.
Macros | |
#define | RSTRUCT_PTR(st) rb_struct_ptr(st) |
Functions | |
VALUE | rb_struct_size (VALUE st) |
Returns the number of struct members. More... | |
VALUE | rb_struct_aref (VALUE st, VALUE k) |
Resembles Struct#[] . More... | |
VALUE | rb_struct_aset (VALUE st, VALUE k, VALUE v) |
Resembles Struct#[]= . More... | |
static long | RSTRUCT_LEN (VALUE st) |
Returns the number of struct members. More... | |
static VALUE | RSTRUCT_SET (VALUE st, int k, VALUE v) |
Resembles Struct#[]= . More... | |
static VALUE | RSTRUCT_GET (VALUE st, int k) |
Resembles Struct#[] . More... | |
Routines to manipulate struct RStruct.
RBIMPL
or rbimpl
are implementation details. Don't take them as canon. They could rapidly appear then vanish. The name (path) of this header file is also an implementation detail. Do not expect it to persist at the place it is now. Developers are free to move it anywhere anytime at will. __VA_ARGS__
is always available. We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98. Definition in file rstruct.h.
#define RSTRUCT_PTR | ( | st | ) | rb_struct_ptr(st) |
Exists here for backwards compatibility only. You can safely forget about it.
Resembles Struct#[]
.
[in] | st | An instance of RStruct. |
[in] | k | Index a.k.a. key of the struct. |
rb_eTypeError | k is neither Numeric, Symbol, nor String. |
rb_eIndexError | Numerical index out of range. |
rb_eNameError | No such key. |
k
in st
. st
must be of RUBY_T_STRUCT. Definition at line 1217 of file struct.c.
Referenced by RSTRUCT_GET().
Resembles Struct#[]=
.
[out] | st | An instance of RStruct. |
[in] | k | Index a.k.a. key of the struct. |
[in] | v | Value to store. |
rb_eTypeError | k is neither Numeric, Symbol, nor String. |
rb_eIndexError | Numerical index out of range. |
rb_eNameError | No such key. |
v
. st
must be of RUBY_T_STRUCT. v
is stored at k
in st
. Definition at line 1255 of file struct.c.
Referenced by RSTRUCT_SET().
Returns the number of struct members.
[in] | st | An instance of RStruct. |
st
. st
must be of RUBY_T_STRUCT. Definition at line 1505 of file struct.c.
Referenced by RSTRUCT_LEN().
Resembles Struct#[]
.
[in] | st | An instance of RStruct. |
[in] | k | Index a.k.a. key of the struct. |
rb_eTypeError | k is neither Numeric, Symbol, nor String. |
rb_eIndexError | Numerical index out of range. |
rb_eNameError | No such key. |
k
in st
. st
must be of RUBY_T_STRUCT. Definition at line 114 of file rstruct.h.
Referenced by rb_struct_aref(), and rb_struct_getmember().
|
inlinestatic |
Returns the number of struct members.
[in] | st | An instance of RStruct. |
st
. st
must be of RUBY_T_STRUCT. Definition at line 94 of file rstruct.h.
Referenced by rb_struct_members(), and rb_struct_size().
Resembles Struct#[]=
.
[out] | st | An instance of RStruct. |
[in] | k | Index a.k.a. key of the struct. |
[in] | v | Value to store. |
rb_eTypeError | k is neither Numeric, Symbol, nor String. |
rb_eIndexError | Numerical index out of range. |
rb_eNameError | No such key. |
v
. st
must be of RUBY_T_STRUCT. v
is stored at k
in st
. Definition at line 104 of file rstruct.h.
Referenced by rb_struct_aset().