1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use crate::{
prelude::*,
string::Encoding,
vm::InstrSeq,
};
pub trait Classify: Object {
fn class() -> Class<Self>;
}
macro_rules! impl_trait {
($($t:ty, $c:ident ;)+) => { $(
impl Classify for $t {
#[inline]
fn class() -> Class<Self> {
unsafe { Class::cast_unchecked(Class::$c()) }
}
}
)+ };
}
impl_trait! {
AnyObject, object;
Class, class;
Module, module;
Array, array;
Hash, hash;
Integer, integer;
String, string;
Symbol, symbol;
Encoding, encoding;
AnyException, exception;
InstrSeq, instr_seq;
}