1use crate::Hash;
2use crate::RawStr;
3use std::cmp;
4use std::hash;
5use std::vec;
6
7#[derive(Debug)]
9#[repr(C)]
10pub struct StaticType {
11 pub name: RawStr,
13 pub hash: Hash,
15}
16
17impl cmp::PartialEq for &'static StaticType {
18 fn eq(&self, other: &Self) -> bool {
19 self.hash == other.hash
20 }
21}
22
23impl cmp::Eq for &'static StaticType {}
24
25impl hash::Hash for &'static StaticType {
26 fn hash<H: hash::Hasher>(&self, state: &mut H) {
27 self.hash.hash(state)
28 }
29}
30
31pub static UNIT_TYPE: &StaticType = &StaticType {
33 name: RawStr::from_str("unit"),
34 hash: Hash::new(0x9de148b05752dbb3),
35};
36
37impl_static_type!(() => UNIT_TYPE);
38impl_static_type!(crate::UnitStruct => UNIT_TYPE);
39
40pub static BYTE_TYPE: &StaticType = &StaticType {
42 name: RawStr::from_str("byte"),
43 hash: Hash::new(0x190cacf7c7187189),
44};
45
46impl_static_type!(u8 => BYTE_TYPE);
47
48pub static BOOL_TYPE: &StaticType = &StaticType {
50 name: RawStr::from_str("bool"),
51 hash: Hash::new(0xbe6bff4422d0c759),
52};
53
54impl_static_type!(bool => BOOL_TYPE);
55
56pub static CHAR_TYPE: &StaticType = &StaticType {
58 name: RawStr::from_str("char"),
59 hash: Hash::new(0xc56a31d061187c8b),
60};
61
62impl_static_type!(char => CHAR_TYPE);
63
64pub static INTEGER_TYPE: &StaticType = &StaticType {
66 name: RawStr::from_str("integer"),
67 hash: Hash::new(0xbb378867da3981e2),
68};
69
70impl_static_type!(i8 => INTEGER_TYPE);
71impl_static_type!(u16 => INTEGER_TYPE);
72impl_static_type!(i16 => INTEGER_TYPE);
73impl_static_type!(u32 => INTEGER_TYPE);
74impl_static_type!(i32 => INTEGER_TYPE);
75impl_static_type!(u64 => INTEGER_TYPE);
76impl_static_type!(i64 => INTEGER_TYPE);
77impl_static_type!(u128 => INTEGER_TYPE);
78impl_static_type!(i128 => INTEGER_TYPE);
79
80pub static FLOAT_TYPE: &StaticType = &StaticType {
82 name: RawStr::from_str("float"),
83 hash: Hash::new(0x13e40c27462ed8fc),
84};
85
86impl_static_type!(f32 => FLOAT_TYPE);
87impl_static_type!(f64 => FLOAT_TYPE);
88
89pub static STRING_TYPE: &StaticType = &StaticType {
91 name: RawStr::from_str("String"),
92 hash: Hash::new(0x823ede4114ff8de6),
93};
94
95impl_static_type!(String => STRING_TYPE);
96impl_static_type!(str => STRING_TYPE);
97
98pub static BYTES_TYPE: &StaticType = &StaticType {
100 name: RawStr::from_str("Bytes"),
101 hash: Hash::new(0x957fa73126817683),
102};
103
104impl_static_type!(crate::Bytes => BYTES_TYPE);
105impl_static_type!([u8] => BYTES_TYPE);
106
107pub static VEC_TYPE: &StaticType = &StaticType {
109 name: RawStr::from_str("Vec"),
110 hash: Hash::new(0x6c129752545b4223),
111};
112
113impl_static_type!(crate::Vec => VEC_TYPE);
114impl_static_type!(impl<T> vec::Vec<T> => VEC_TYPE);
115impl_static_type!([crate::Value] => VEC_TYPE);
116impl_static_type!(impl<T> crate::VecTuple<T> => VEC_TYPE);
117
118pub static TUPLE_TYPE: &StaticType = &StaticType {
120 name: RawStr::from_str("Tuple"),
121 hash: Hash::new(0x6da74f62cfa5cc1f),
122};
123
124impl_static_type!(crate::Tuple => TUPLE_TYPE);
125
126pub static OBJECT_TYPE: &StaticType = &StaticType {
128 name: RawStr::from_str("Object"),
129 hash: Hash::new(0x65f4e1cf10b1f34c),
130};
131
132impl_static_type!(crate::Object => OBJECT_TYPE);
133impl_static_type!(crate::Struct => OBJECT_TYPE);
134
135pub static RANGE_TYPE: &StaticType = &StaticType {
137 name: RawStr::from_str("Range"),
138 hash: Hash::new(0xde6d8aadf191516b),
139};
140
141impl_static_type!(crate::Range => RANGE_TYPE);
142
143pub static FUTURE_TYPE: &StaticType = &StaticType {
145 name: RawStr::from_str("Future"),
146 hash: Hash::new(0xafab4a2797436aee),
147};
148
149impl_static_type!(crate::Future => FUTURE_TYPE);
150
151pub static GENERATOR_TYPE: &StaticType = &StaticType {
153 name: RawStr::from_str("Generator"),
154 hash: Hash::new(0x50deff8c6ef7532c),
155};
156
157impl_static_type!(crate::Generator => GENERATOR_TYPE);
158
159pub static GENERATOR_STATE_TYPE: &StaticType = &StaticType {
161 name: RawStr::from_str("GeneratorState"),
162 hash: Hash::new(0xdd4141d4d8a3ac31),
163};
164
165impl_static_type!(crate::GeneratorState => GENERATOR_STATE_TYPE);
166
167pub static STREAM_TYPE: &StaticType = &StaticType {
169 name: RawStr::from_str("Stream"),
170 hash: Hash::new(0xd94133730d02c3ea),
171};
172
173impl_static_type!(crate::Stream => STREAM_TYPE);
174
175pub static RESULT_TYPE: &StaticType = &StaticType {
177 name: RawStr::from_str("Result"),
178 hash: Hash::new(0xecec15e1363240ac),
179};
180
181impl_static_type!(impl<T, E> Result<T, E> => RESULT_TYPE);
182
183pub static OPTION_TYPE: &StaticType = &StaticType {
185 name: RawStr::from_str("Option"),
186 hash: Hash::new(0x5e08dc3f663c72db),
187};
188
189impl_static_type!(impl<T> Option<T> => OPTION_TYPE);
190
191pub static FUNCTION_TYPE: &StaticType = &StaticType {
193 name: RawStr::from_str("Function"),
194 hash: Hash::new(0x45b788b02e7f231c),
195};
196
197impl_static_type!(crate::Function => FUNCTION_TYPE);
198impl_static_type!(crate::Shared<crate::Function> => FUNCTION_TYPE);
199impl_static_type!(impl<T> std::collections::HashMap<String, T> => OBJECT_TYPE);
200
201pub static FORMAT_TYPE: &StaticType = &StaticType {
203 name: RawStr::from_str("Format"),
204 hash: Hash::new(0x8d6bddd19f58e97a),
205};
206
207impl_static_type!(crate::Format => FORMAT_TYPE);
208
209pub static ITERATOR_TYPE: &StaticType = &StaticType {
211 name: RawStr::from_str("Iterator"),
212 hash: Hash::new(0xe08fbd4d99f308e9),
213};
214
215impl_static_type!(crate::Iterator => ITERATOR_TYPE);
216
217pub static TYPE: &StaticType = &StaticType {
219 name: RawStr::from_str("Type"),
220 hash: Hash::new(0x3cb9320f24bf56f0),
221};