mirror of
https://github.com/navidrome/navidrome.git
synced 2026-12-01 09:40:24 +00:00
44 lines
1.0 KiB
Rust
44 lines
1.0 KiB
Rust
// Code generated by ndpgen. DO NOT EDIT.
|
|
//
|
|
// This file contains client wrappers for the Counter host service.
|
|
// It is intended for use in Navidrome plugins built with extism-pdk.
|
|
|
|
use extism_pdk::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Debug, Clone, Serialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
struct CounterCountRequest {
|
|
name: String,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
struct CounterCountResponse {
|
|
#[serde(default)]
|
|
value: i32,
|
|
}
|
|
|
|
#[link(wasm_import_module = "extism:host/user")]
|
|
extern "C" {
|
|
fn counter_count(input: u64) -> u64;
|
|
}
|
|
|
|
/// Calls the counter_count host function.
|
|
///
|
|
/// # Arguments
|
|
/// * `name` - String parameter.
|
|
///
|
|
/// # Returns
|
|
/// The value value.
|
|
///
|
|
/// # Errors
|
|
/// Returns an error if the host function call fails.
|
|
pub fn count(name: &str) -> Result<i32, Error> {
|
|
let response: CounterCountResponse = unsafe { nd_pdk_types::hostcall::call(counter_count, &CounterCountRequest {
|
|
name: name.to_owned(),
|
|
}) }?;
|
|
|
|
Ok(response.value)
|
|
}
|