navidrome/plugins/cmd/hostgen/testdata/ping_client_expected.rs
2025-12-31 17:06:31 -05:00

36 lines
831 B
Rust

// Code generated by hostgen. DO NOT EDIT.
//
// This file contains client wrappers for the Ping host service.
// It is intended for use in Navidrome plugins built with extism-pdk.
use extism_pdk::*;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
struct PingPingResponse {
#[serde(default)]
error: Option<String>,
}
#[host_fn]
extern "ExtismHost" {
fn ping_ping(input: Json<serde_json::Value>) -> Json<PingPingResponse>;
}
/// Calls the ping_ping host function.
///
/// # Errors
/// Returns an error if the host function call fails.
pub fn ping() -> Result<(), Error> {
let response = unsafe {
ping_ping(Json(serde_json::json!({})))?
};
if let Some(err) = response.0.error {
return Err(Error::msg(err));
}
Ok(())
}