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