alef 0.71.0

Opinionated polyglot binding generator for Rust libraries
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
    /// {{ doc }}.
    pub fn {{ method_name }}(
        self: *{{ service_name }},
        callback: *const fn (*anyopaque, [*:0]const u8) callconv(.c) [*:0]u8,
        response_free: *const fn ([*:0]u8) callconv(.c) void,
        context: *anyopaque{{ params_decl }}
    ) c_int {
        const owner_handle = self.owner;
        if (owner_handle == 0) return 1;

        return c.{{ c_fn }}(
            owner_handle,
            @ptrCast(callback),
            @ptrCast(response_free),
            context{{ args }}
        );
    }