Skip to content

Add support for "closure user_data" and "closure scope call" #618

Closed
@sdroege

Description

@sdroege

We should be able to autogenerate trampolines and safe bindings for all functions taking "closure scope call" (e.g. gtk_list_box_selected_foreach() https://github.com/sdroege/gtk-rs/blob/24c4c8305c235592c49bf2018d0f6e0afdeeb4d7/src/list_box.rs#L76-L102) and generally closures that have a user_data and destroy_notify (e.g. gtk_list_box_bind_model(), https://github.com/sdroege/gtk-rs/blob/24c4c8305c235592c49bf2018d0f6e0afdeeb4d7/src/list_box.rs#L38-L73).

The trampolines are basically the same as for signals, "scope call" closures can be FnMut and directly passed via the stack, other closures need to be stored (just like for signals) in a Box and need to be `'static'.

The Send / Sync bounds can be inferred from the corresponding bounds on the object (but like for signals an override would make sense).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions