alef 0.24.13

Opinionated polyglot binding generator for Rust libraries
Documentation
{%- if doc %}
{{ doc }}{%- endif %}
    public func {{ ep_camel }}({{ param_sig }}){{ throws_kw }} -> {{ return_type }} {
        guard let inner = inner else { throw ServiceError.invalidHandle }

        // swift-bridge emits `fn {{ ep_camel }}(client: &mut App) -> String;` as a free
        // module function — the wrapper class itself does not gain `inner.{{ ep_camel }}()`.
        let result = RustBridge.{{ ep_camel }}(inner{% for ep_param in params %}, {{ ep_param.name }}{% endfor %}).toString()

        {% if has_error %}
        // The Rust wrapper flattens `Result<T, E>` into a String envelope:
        // empty string means success, non-empty carries the formatted error.
        // swift-bridge 0.1.59 does not bridge native Swift `Result`s.
        if !result.isEmpty {
            throw ServiceError.runtime(result)
        }
        {% elif has_return_value %}
        return result
        {% endif %}
    }