Skip to main content

ENCODING_GET

Function ENCODING_GET 

Source
pub unsafe fn ENCODING_GET(obj: VALUE) -> c_int
Expand description

Get encoding index from object (akin to ENCODING_GET).

Returns the encoding index stored in the object’s flags.

@param[in] obj A Ruby object with encoding (String, Regexp, Symbol). @return Encoding index.

§Safety

This function is unsafe because it dereferences a raw pointer to access the RBasic flags. The caller must ensure the VALUE is a valid object with encoding support.