alef 0.25.37

Opinionated polyglot binding generator for Rust libraries
Documentation
    pub {% if is_async %}async {% endif %}fn {{ method_name }}(
        &mut self,
{%- for param in params %}
        {{ param.name }}: {{ param.rust_type }},
{%- endfor %}
    ) -> Result<{{ return_type }}, String> {
        let mut guard = self.inner.blocking_lock();
        let inner = guard.take().ok_or_else(|| "Service not initialized".to_string())?;
        drop(guard);

        {%- if is_async %}
        let result = inner.{{ method_name }}(
        {%- else %}
        let result = inner.{{ method_name }}(
        {%- endif %}
{%- for param in params %}
            {{ param.name }},
{%- endfor %}
        )
        {%- if is_async %}.await;
        {%- else %};
        {%- endif %}

        result.map_err(|e| e.to_string())
    }