Module rb_sys::macros

source ·
Expand description

Implementation of Ruby macros.

Since macros are rely on the C preprocessor, or defined as inline C functions, they are not available when linking libruby. In order to use the libruby macros from Rust, rb-sys implements them using the following strategies:

  1. Some macros are implemented in Rust, as inline functions. Using these does not require compiling C code, and can be used in Rust code without the ruby-macros feature.
  2. The rest are implemented in C code that exports the macros as functions that can be used in Rust. This requires the ruby-macros feature.

Functions

  • Checks if the given object is a so-called Fixnum.
  • Checks if the given object is a so-called Flonum.
  • Checks if the given object is an immediate i.e. an object which has no corresponding storage inside of the object space.
  • Checks if the given object is nil.
  • Get the backend storage of a Ruby array.
  • Get the length of a Ruby array.
  • Checks if the given object is of enum ::ruby_special_consts.
  • Checks if the given object is a static symbol.
  • Emulates Ruby’s “if” statement.