| 95 | |
| 96 | #[unsafe(no_mangle)] |
| 97 | pub unsafe extern "C" fn wasmtime_structref_set_field( |
| 98 | mut cx: WasmtimeStoreContextMut<'_>, |
| 99 | structref: Option<&wasmtime_structref_t>, |
| 100 | index: usize, |
| 101 | val: &crate::wasmtime_val_t, |
| 102 | ) -> Option<Box<crate::wasmtime_error_t>> { |
| 103 | let structref = structref |
| 104 | .and_then(|s| s.as_wasmtime()) |
| 105 | .expect("non-null structref required"); |
| 106 | let mut scope = RootScope::new(&mut cx); |
| 107 | let rooted = structref.to_rooted(&mut scope); |
| 108 | let rust_val = val.to_val(&mut scope); |
| 109 | match rooted.set_field(&mut scope, index, rust_val) { |
| 110 | Ok(()) => None, |
| 111 | Err(e) => Some(Box::new(e.into())), |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | #[unsafe(no_mangle)] |
| 116 | pub unsafe extern "C" fn wasmtime_structref_type( |