alef 0.25.37

Opinionated polyglot binding generator for Rust libraries
Documentation
impl {{ core_import }}::{{ trait_name }} for {{ bridge_name }} {
    fn {{ dispatch_name }}(
        &self{{ extra_param }},
        {{ wire_name }}: {{ req_path }},
    ) -> std::pin::Pin<Box<dyn std::future::Future<Output = {{ output_type }}> + Send + '_>> {
        Box::pin(async move {
            // Serialize request to JSON and call the ThreadsafeFunction
            let outcome: {{ wire_output }} = async move {
                let req_json = serde_json::to_value(&{{ wire_name }})
                    .map_err(|e| Box::new(e) as {{ box_err }})?;
                let resp_json = self.handler_fn
                    .call_async(Ok(req_json))
                    .await
                    .map_err(|e| Box::new(e) as {{ box_err }})?;
                serde_json::from_value(resp_json)
                    .map_err(|e| Box::new(e) as {{ box_err }})
            }
            .await;

            {{ tail }}
        })
    }
}