artichoke_backend/extn/stdlib/ostruct/
mod.rs1use std::ffi::CStr;
2
3use crate::extn::prelude::*;
4
5const OPEN_STRUCT_CSTR: &CStr = c"OpenStruct";
6static OPEN_STRUCT_RUBY_SOURCE: &[u8] = include_bytes!("vendor/ostruct.rb");
7
8pub fn init(interp: &mut Artichoke) -> InitializeResult<()> {
9 let spec = class::Spec::new("OpenStruct", OPEN_STRUCT_CSTR, None, None)?;
10 interp.def_class::<OpenStruct>(spec)?;
11 interp.def_rb_source_file("ostruct.rb", OPEN_STRUCT_RUBY_SOURCE)?;
12
13 Ok(())
14}
15
16#[derive(Debug, Clone, Copy)]
17pub struct OpenStruct;