Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
Functions
struct.h File Reference

Public APIs related to rb_cStruct. More...

#include "ruby/internal/dllexport.h"
#include "ruby/internal/intern/vm.h"
#include "ruby/internal/value.h"

Go to the source code of this file.

Functions

VALUE rb_struct_new (VALUE,...)
 
VALUE rb_struct_define (const char *,...)
 
VALUE rb_struct_define_under (VALUE, const char *,...)
 
VALUE rb_struct_alloc (VALUE, VALUE)
 
VALUE rb_struct_initialize (VALUE, VALUE)
 
VALUE rb_struct_aref (VALUE, VALUE)
 
VALUE rb_struct_aset (VALUE, VALUE, VALUE)
 
VALUE rb_struct_getmember (VALUE, ID)
 
VALUE rb_struct_s_members (VALUE)
 
VALUE rb_struct_members (VALUE)
 
VALUE rb_struct_size (VALUE s)
 
VALUE rb_struct_alloc_noinit (VALUE)
 
VALUE rb_struct_define_without_accessor (const char *, VALUE, rb_alloc_func_t,...)
 
VALUE rb_struct_define_without_accessor_under (VALUE outer, const char *class_name, VALUE super, rb_alloc_func_t alloc,...)
 

Detailed Description

Public APIs related to rb_cStruct.

Author
Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.org
Warning
Symbols prefixed with either 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.
Note
To ruby-core: remember that this header can be possibly recursively included from extension libraries written in C++. Do not expect for instance __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 struct.h.

Function Documentation

◆ rb_struct_alloc()

VALUE rb_struct_alloc ( VALUE  klass,
VALUE  values 
)

Definition at line 760 of file struct.c.

References RARRAY_CONST_PTR, and rb_class_new_instance().

◆ rb_struct_alloc_noinit()

VALUE rb_struct_alloc_noinit ( VALUE  klass)

Definition at line 381 of file struct.c.

◆ rb_struct_aref()

VALUE rb_struct_aref ( VALUE  s,
VALUE  idx 
)

Definition at line 1096 of file struct.c.

Referenced by InitVM_Struct().

◆ rb_struct_aset()

VALUE rb_struct_aset ( VALUE  s,
VALUE  idx,
VALUE  val 
)

Definition at line 1123 of file struct.c.

Referenced by InitVM_Struct().

◆ rb_struct_define()

VALUE rb_struct_define ( const char *  name,
  ... 
)

Definition at line 464 of file struct.c.

References name, rb_cStruct, and rb_str_new2.

◆ rb_struct_define_under()

VALUE rb_struct_define_under ( VALUE  outer,
const char *  name,
  ... 
)

Definition at line 479 of file struct.c.

References name, rb_cStruct, and rb_define_class_under().

Referenced by Init_etc(), and InitVM_process().

◆ rb_struct_define_without_accessor()

VALUE rb_struct_define_without_accessor ( const char *  class_name,
VALUE  super,
rb_alloc_func_t  alloc,
  ... 
)

Definition at line 451 of file struct.c.

Referenced by Init_Range().

◆ rb_struct_define_without_accessor_under()

VALUE rb_struct_define_without_accessor_under ( VALUE  outer,
const char *  class_name,
VALUE  super,
rb_alloc_func_t  alloc,
  ... 
)

Definition at line 438 of file struct.c.

◆ rb_struct_getmember()

VALUE rb_struct_getmember ( VALUE  obj,
ID  id 
)

Definition at line 219 of file struct.c.

References ID2SYM, Qnil, RSTRUCT_GET, and UNREACHABLE_RETURN.

◆ rb_struct_initialize()

VALUE rb_struct_initialize ( VALUE  self,
VALUE  values 
)

Definition at line 693 of file struct.c.

References Qnil, RARRAY_CONST_PTR, RB_GC_GUARD, and struct_hash_set_arg::self.

◆ rb_struct_members()

VALUE rb_struct_members ( VALUE  s)

◆ rb_struct_new()

VALUE rb_struct_new ( VALUE  klass,
  ... 
)

Definition at line 766 of file struct.c.

References N_REF_FUNC, numberof, rb_ary_tmp_new(), rb_class_new_instance(), and rb_long2int.

◆ rb_struct_s_members()

VALUE rb_struct_s_members ( VALUE  klass)

Definition at line 66 of file struct.c.

References NIL_P, rb_eTypeError, rb_raise(), and T_ARRAY.

Referenced by rb_struct_members().

◆ rb_struct_size()

VALUE rb_struct_size ( VALUE  s)

Definition at line 1326 of file struct.c.

Referenced by InitVM_Struct().