1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use std::ffi::CStr;

use crate::extn::prelude::*;

const SET_CSTR: &CStr = qed::const_cstr_from_str!("Set\0");
const SORTED_SET_CSTR: &CStr = qed::const_cstr_from_str!("SortedSet\0");
static SET_RUBY_SOURCE: &[u8] = include_bytes!("vendor/set.rb");

pub fn init(interp: &mut Artichoke) -> InitializeResult<()> {
    let spec = class::Spec::new("Set", SET_CSTR, None, None)?;
    interp.def_class::<Set>(spec)?;
    let spec = class::Spec::new("SortedSet", SORTED_SET_CSTR, None, None)?;
    interp.def_class::<SortedSet>(spec)?;
    interp.def_rb_source_file("set.rb", SET_RUBY_SOURCE)?;

    Ok(())
}

#[derive(Debug, Clone, Copy)]
pub struct Set;

#[derive(Debug, Clone, Copy)]
pub struct SortedSet;