gtk-rs / gir

Tool to generate rust bindings and user API for glib-based libraries
https://gtk-rs.org/gir/book/
MIT License
230 stars 102 forks source link

Gir doesn't generate callback ("gir cannot generate nullable async callback") #795

Open haecker-felix opened 5 years ago

haecker-felix commented 5 years ago

Gir refuses to generate soup_session_queue_message:

    //fn queue_message<P: IsA<Message>>(&self, msg: &P, callback: Option<Box<dyn FnOnce(&Session, &Message) + 'static>>) {
    //    unsafe { TODO: call soup_sys:soup_session_queue_message() }
    //}

https://gitlab.gnome.org/haecker-felix/soup-rs/blob/master/soup/src/auto/session.rs#L459

The fn itself exists in my sys crate: pub fn soup_session_queue_message(session: *mut SoupSession, msg: *mut SoupMessage, callback: SoupSessionCallback, user_data: gpointer); https://gitlab.gnome.org/haecker-felix/soup-rs/blob/master/soup-sys/src/lib.rs#L2734

While running 'gir', I get this message: Gir doesn't generate callback ("gir cannot generate nullable async callback")

The complete code is here: https://gitlab.gnome.org/haecker-felix/soup-rs

Is there an easy way to fix this? Should it possible to autogenerate this, or do I need to implement it manually?

sdroege commented 5 years ago

@GuillaumeGomez Do you remember why this is not supported currently? We handle nullable callbacks in other cases, and this here would work the same in the generated code or not?

GuillaumeGomez commented 5 years ago

I don't remember precisely but my guess would be because the PR was already huge enough and I didn't encounter this while testing.