Module 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. For stable versions of Ruby, the macros are implemented as Rust functions
  2. For ruby-head, the macros are implemented as C functions that are linked into the crate.

Functions§

FIXNUM_P
Checks if the given object is a so-called Fixnum.
FLONUM_P
Checks if the given object is a so-called Flonum.
IMMEDIATE_P
Checks if the given object is an immediate i.e. an object which has no corresponding storage inside of the object space.
NIL_P
Checks if the given object is nil.
RARRAY_CONST_PTR
Get the backend storage of a Ruby array.
RARRAY_LEN
Get the length of a Ruby array.
RBIGNUM_NEGATIVE_P
Checks if the bignum is negative.
RBIGNUM_POSITIVE_P
Checks if the bignum is positive.
RB_BUILTIN_TYPE
Queries the type of the object.
RB_DYNAMIC_SYM_P
Queries if the object is a dynamic symbol.
RB_FLOAT_TYPE_P
Queries if the object is an instance of ::rb_cFloat.
RB_INTEGER_TYPE_P
Queries if the object is an instance of ::rb_cInteger.
RB_SYMBOL_P
Queries if the object is an instance of ::rb_cSymbol.
RB_TYPE
Identical to RB_BUILTIN_TYPE(), except it can also accept special constants.
RB_TYPE_P
Queries if the given object is of given type.
RSTRING_LEN
Get the length of a Ruby string.
RSTRING_PTR
Get the backend storage of a Ruby string.
RTYPEDDATA_EMBEDDED_P
Checks if the given RTypedData is embedded.
RTYPEDDATA_GET_DATA
Gets the data pointer from an RTypedData object.
RTYPEDDATA_P
Checks if the given object is an RTypedData.
RTYPEDDATA_TYPE
Gets the data type information from an RTypedData object.
SPECIAL_CONST_P
Checks if the given object is of enum ::ruby_special_consts.
STATIC_SYM_P
Checks if the given object is a static symbol.
TEST
Emulates Ruby’s “if” statement.