Expand description
Ruby implicit conversion vocabulary types.
This crate provides a lookup table for Ruby object conversion methods and their metadata. It maps method names to their C string equivalents and categorizes them as either implicit conversions or coercions. This is used when booting an Artichoke interpreter and for implementing native Ruby object conversion routines.
§Examples
use intaglio::bytes::SymbolTable;
use mezzaluna_conversion_methods::{ConvMethods, InitError};
let mut symbols = SymbolTable::new();
let methods = ConvMethods::new();
let table = methods.get_or_init(&mut symbols)?;
assert_eq!(table.len(), 12);
let method = methods.find_method(&mut symbols, "to_int")?;
assert!(method.is_some());
Structs§
- Represents a single Ruby conversion method, including its name, C string representation, unique identifier, and whether it is an implicit conversion.
- A table of Ruby conversion methods and their metadata.
- Error type for conversion method table initialization failures.
Enums§
- Whether the conversion is implicit, like
#to_int
, or a coercion, like#to_i
.
Constants§
- Defines the supported Ruby object conversion methods and their metadata.