zbus doesn't support cfg attributes on interface methods as a workaround, we make the *call to the internal API* conditionally compile and return an error on unsupported platforms.
(&self, vm_coredump_data: String)
| 192 | // as a workaround, we make the *call to the internal API* conditionally |
| 193 | // compile and return an error on unsupported platforms. |
| 194 | async fn vm_coredump(&self, vm_coredump_data: String) -> Result<()> { |
| 195 | #[cfg(all(target_arch = "x86_64", feature = "guest_debug"))] |
| 196 | { |
| 197 | let vm_coredump_data = serde_json::from_str(&vm_coredump_data).map_err(api_error)?; |
| 198 | self.vm_action(&VmCoredump, vm_coredump_data) |
| 199 | .await |
| 200 | .map(|_| ()) |
| 201 | } |
| 202 | |
| 203 | #[cfg(not(all(target_arch = "x86_64", feature = "guest_debug")))] |
| 204 | Err(api_error( |
| 205 | "VmCoredump only works on x86_64 with the `guest_debug` feature enabled", |
| 206 | )) |
| 207 | } |
| 208 | |
| 209 | async fn vm_counters(&self) -> Result<Optional<String>> { |
| 210 | self.vm_action(&VmCounters, ()).await |