Build a Lean Ixon.SerializeError from a Rust SerializeError. Tags 0–6: 0: unexpectedEof (expected : String) → 1 obj 1: invalidTag (tag : UInt8) (context : String) → 1 obj + 1 scalar (UInt8) 2: invalidFlag (flag : UInt8) (context : String) → 1 obj + 1 scalar (UInt8) 3: invalidVariant (variant : UInt64) (context : String) → 1 obj + 8 scalar (UInt64) 4: invalidBool (value : UInt8) → 0 obj + 1 scalar
(se: &SerializeError)
| 1165 | |
| 1166 | /// FFI: Look up a constant's compiled address from RustCompiledEnv. |
| 1167 | /// Copies the 32-byte blake3 hash into the provided ByteArray. |
| 1168 | /// Returns 1 on success, 0 if name not found. |
| 1169 | #[cfg(feature = "test-ffi")] |
| 1170 | #[unsafe(no_mangle)] |
| 1171 | extern "C" fn rs_lookup_const_addr( |
| 1172 | rust_env: *const RustCompiledEnv, |
| 1173 | name_ptr: LeanOwned, |
| 1174 | out_addr: LeanByteArray<LeanOwned>, |
| 1175 | ) -> u64 { |
| 1176 | if rust_env.is_null() { |
| 1177 | return 0; |
| 1178 | } |
| 1179 | let global_cache = GlobalCache::default(); |
| 1180 | let name = decode_name(name_ptr.borrow(), &global_cache); |
| 1181 | |
| 1182 | let rust_env = unsafe { &*rust_env }; |
| 1183 | |
| 1184 | // Look up the address for this name |
| 1185 | match rust_env.compile_state.name_to_addr.get(&name) { |
| 1186 | Some(addr_ref) => { |
| 1187 | // Copy the 32-byte address into the output ByteArray |
| 1188 | unsafe { out_addr.set_data(addr_ref.as_bytes()) }; |
| 1189 | 1 |
| 1190 | }, |
| 1191 | None => 0, |
| 1192 | } |
| 1193 | } |
| 1194 | |
| 1195 | /// FFI: Get the total number of compiled constants in RustCompiledEnv. |
| 1196 | #[cfg(feature = "test-ffi")] |
| 1197 | #[unsafe(no_mangle)] |
| 1198 | extern "C" fn rs_get_compiled_const_count( |
| 1199 | rust_env: *const RustCompiledEnv, |
| 1200 | ) -> u64 { |
| 1201 | if rust_env.is_null() { |
| 1202 | return 0; |
| 1203 | } |
| 1204 | let rust_env = unsafe { &*rust_env }; |
| 1205 | rust_env.compile_state.name_to_addr.len() as u64 |
| 1206 | } |
| 1207 | |
| 1208 | // ============================================================================= |
nothing calls this directly
no test coverage detected