Conversions between a primitive type and a `u32` for insertion into an instruction.
| 107 | |
| 108 | /// Conversions between a primitive type and a `u32` for insertion into an instruction. |
| 109 | trait RawValue: Sized { |
| 110 | /// Converts a `u32` to the primitive type `Self`. |
| 111 | /// |
| 112 | /// This operation is only performed to _parse_ bytecode and we assume that the bytecode is |
| 113 | /// correctly formed. As a result, this does not perform any range checks. |
| 114 | fn from_u32(v: u32) -> Self; |
| 115 | |
| 116 | /// Converts the primitive type `Self` to a u32. |
| 117 | /// |
| 118 | /// This operation is only performed to _generate_ bytecode during compilation, and all |
| 119 | /// instruction definitions need to have fields that always fit in a u32. Consequently, |
| 120 | /// this operation is always safe. |
| 121 | fn to_u32(self) -> u32; |
| 122 | } |
| 123 | |
| 124 | /// Implements `RawValue` for an unsigned primitive type that is narrower than `u32`. |
| 125 | macro_rules! impl_raw_value { |
nothing calls this directly
no outgoing calls
no test coverage detected