extern "Rust" {
// Expose the opaque pointer as a `usize` so the Swift wrapper can hand it
// through the @_silgen_name'd extern "C" callback-registration shim. The
// swift-bridge generated class stores its raw pointer as an `internal`
// field, so the consumer module cannot reach it directly.
#[swift_bridge(swift_name = "{{ service_camel }}RawPtr")]
fn {{ service_snake }}_raw_ptr(client: &mut {{ service_name }}) -> usize;
{%- for config in configurators %}
#[swift_bridge(swift_name = "{{ config.camel }}")]
fn {{ config.name }}(client: &mut {{ service_name }});
{%- endfor %}
{%- for ep in entrypoints %}
#[swift_bridge(swift_name = "{{ ep.camel }}")]
fn {{ ep.snake }}(
client: &mut {{ service_name }},
{%- for param in ep.params %}
{{ param.name }}: {{ param.rust_type }},
{%- endfor %}
) -> {{ ep.return_type }};
{%- endfor %}
}
{%- for wc in wrapper_constructors %}
extern "Rust" {
// Factory for constructing {{ wc.wrapper_type_name }} from its constructor args.
// Used by variant registration methods that need to build a {{ wc.wrapper_type_name }}
// before forwarding to the base callback-registration C function. swift-bridge
// represents enum types (e.g. Method) as opaque classes — there are no static
// member constants — so a dedicated factory is required.
#[swift_bridge(swift_name = "{{ wc.fn_camel }}")]
fn {{ wc.fn_snake }}({% for arg in wc.args %}{{ arg.name }}: {{ arg.rust_type }}{% if not loop.last %}, {% endif %}{% endfor %}) -> {{ wc.wrapper_type_name }};
}
{%- endfor %}