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:
- For stable versions of Ruby, the macros are implemented as Rust functions
- 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
ID2SYMorRB_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
SYM2IDorRB_SYM2ID). - TEST
- Emulates Ruby’s “if” statement.
- ULON
G2NUM - Convert unsigned long to Ruby Integer (akin to
ULONG2NUM).