1 use super::*; 2 3 #[doc(hidden)] 4 pub unsafe trait RuntimeType: Abi + Clone + PartialEq { 5 const SIGNATURE: ConstBuffer; 6 } 7 8 macro_rules! primitive_runtime_types { 9 ($(($t:ty, $s:literal)),+) => { 10 $( 11 unsafe impl RuntimeType for $t { 12 const SIGNATURE: ConstBuffer = ConstBuffer::from_slice($s); 13 } 14 unsafe impl Abi for $t { 15 type Abi = Self; 16 type DefaultType = Self; 17 } 18 )* 19 }; 20 } 21 22 primitive_runtime_types! { 23 (bool, b"b1"), 24 (i8, b"i1"), 25 (u8, b"u1"), 26 (i16, b"i2"), 27 (u16, b"u2"), 28 (i32, b"i4"), 29 (u32, b"u4"), 30 (i64, b"i8"), 31 (u64, b"u8"), 32 (f32, b"f4"), 33 (f64, b"f8") 34 } 35 36 unsafe impl Abi for isize { 37 type Abi = Self; 38 type DefaultType = Self; 39 } 40 41 unsafe impl Abi for usize { 42 type Abi = Self; 43 type DefaultType = Self; 44 } 45