artichoke_backend/extn/core/comparable/
mod.rs1use std::ffi::CStr;
2
3use crate::extn::prelude::*;
4
5const COMPARABLE_CSTR: &CStr = c"Comparable";
6static COMPARABLE_RUBY_SOURCE: &[u8] = include_bytes!("comparable.rb");
7
8pub fn init(interp: &mut Artichoke) -> InitializeResult<()> {
9 if interp.is_module_defined::<Comparable>() {
10 return Ok(());
11 }
12
13 let spec = module::Spec::new(interp, "Comparable", COMPARABLE_CSTR, None)?;
14 module::Builder::for_spec(interp, &spec).define()?;
15 interp.def_module::<Comparable>(spec)?;
16 interp.eval(COMPARABLE_RUBY_SOURCE)?;
17
18 Ok(())
19}
20
21#[derive(Debug, Clone, Copy)]
22pub struct Comparable;