Module macros

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§

FIX2LONG
Convert Fixnum to long (akin to FIX2LONG).
FIX2ULONG
Convert Fixnum to unsigned long (akin to FIX2ULONG).
FIXABLE
Check if long value can be represented as Fixnum (akin to FIXABLE).
FIXNUM_P
Checks if the given object is a so-called Fixnum.
FLONUM_P
Checks if the given object is a so-called Flonum.
ID2SYM
Convert ID to Symbol (akin to ID2SYM or RB_ID2SYM).
IMMEDIATE_P
Checks if the given object is an immediate i.e. an object which has no corresponding storage inside of the object space.
LONG2FIX
Convert long to Fixnum (akin to LONG2FIX).
LONG2NUM
Convert long to Ruby Integer (akin to LONG2NUM).
NIL_P
Checks if the given object is nil.
NUM2LONG
Convert Ruby Integer to long (akin to NUM2LONG).
NUM2ULONG
Convert Ruby Integer to unsigned long (akin to NUM2ULONG).
POSFIXABLE
Check if unsigned long value can be represented as positive Fixnum (akin to POSFIXABLE).
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_ID2SYM
Alias for ID2SYM for compatibility with Ruby naming conventions.
RB_INTEGER_TYPE_P
Queries if the object is an instance of ::rb_cInteger.
RB_SYM2ID
Alias for SYM2ID for compatibility with Ruby naming conventions.
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.
SYM2ID
Convert Symbol to ID (akin to SYM2ID or RB_SYM2ID).
TEST
Emulates Ruby’s “if” statement.
ULONG2NUM
Convert unsigned long to Ruby Integer (akin to ULONG2NUM).