use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct WasmExportSpec {
pub id: &'static str,
pub label: &'static str,
pub rust_function_name: &'static str,
pub js_function_name: &'static str,
pub input_type: &'static str,
pub output_type: &'static str,
pub source_module: &'static str,
pub feature_required: &'static str,
}
pub const WASM_EXPORTS: &[WasmExportSpec] = &[
WasmExportSpec {
id: "export-autonomic-execute-cycle",
label: "autonomic_execute_cycle",
rust_function_name: "autonomic_execute_cycle",
js_function_name: "autonomic_execute_cycle",
input_type: "(log_handle: &str, activity_key: &str, config_json: &str)",
output_type: "Result<String, JsValue>",
source_module: "lib",
feature_required: "",
},
WasmExportSpec {
id: "export-circuit-breaker-reset",
label: "circuit_breaker_reset",
rust_function_name: "circuit_breaker_reset",
js_function_name: "circuit_breaker_reset",
input_type: "",
output_type: "Result<String, JsValue>",
source_module: "lib",
feature_required: "",
},
WasmExportSpec {
id: "export-clear-all-caches",
label: "clear_all_caches",
rust_function_name: "clear_all_caches",
js_function_name: "clear_all_caches",
input_type: "",
output_type: "()",
source_module: "lib",
feature_required: "",
},
WasmExportSpec {
id: "export-get-capabilities",
label: "get_capabilities",
rust_function_name: "get_capabilities",
js_function_name: "get_capabilities",
input_type: "",
output_type: "String",
source_module: "lib",
feature_required: "",
},
WasmExportSpec {
id: "export-get-version",
label: "get_version",
rust_function_name: "get_version",
js_function_name: "get_version",
input_type: "",
output_type: "String",
source_module: "lib",
feature_required: "",
},
WasmExportSpec {
id: "export-init",
label: "init",
rust_function_name: "init",
js_function_name: "init",
input_type: "",
output_type: "Result<String, JsValue>",
source_module: "lib",
feature_required: "",
},
WasmExportSpec {
id: "export-rl-orchestrator-reset",
label: "rl_orchestrator_reset",
rust_function_name: "rl_orchestrator_reset",
js_function_name: "rl_orchestrator_reset",
input_type: "",
output_type: "Result<String, JsValue>",
source_module: "lib",
feature_required: "",
},
WasmExportSpec {
id: "export-rl-orchestrator-telemetry",
label: "rl_orchestrator_telemetry",
rust_function_name: "rl_orchestrator_telemetry",
js_function_name: "rl_orchestrator_telemetry",
input_type: "",
output_type: "Result<String, JsValue>",
source_module: "lib",
feature_required: "",
},
WasmExportSpec {
id: "export-simd-token-replay",
label: "simd_token_replay",
rust_function_name: "simd_token_replay",
js_function_name: "simd_token_replay",
input_type: "(log_handle: &str, activity_key: &str)",
output_type: "String",
source_module: "lib",
feature_required: "conformance_basic",
},
];
impl WasmExportSpec {
pub fn all_names() -> Vec<&'static str> {
WASM_EXPORTS.iter().map(|e| e.rust_function_name).collect()
}
pub fn by_rust_name(name: &str) -> Option<&'static WasmExportSpec> {
WASM_EXPORTS.iter().find(|e| e.rust_function_name == name)
}
}