Crate mezzaluna_conversion_methods

Source
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 an implicit conversion or coercion. 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§

ConvMethod
Represents a single Ruby conversion method, including its name, C string representation, unique identifier, and whether it is an implicit conversion.
ConvMethods
A table of Ruby conversion methods and their metadata.
InitError
Error type for conversion method table initialization failures.

Enums§

ConversionType
Whether the conversion is implicit, like #to_int, or a coercion, like #to_i.

Constants§

CONVERSION_METHODS
Defines the supported Ruby object conversion methods and their metadata.