gtk-rs / gir

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

Fix missing IsA<_> for user callbacks #709

Open GuillaumeGomez opened 5 years ago

GuillaumeGomez commented 5 years ago

In reference to this conversation: https://github.com/gtk-rs/gtk/pull/760/files#r249967963

sdroege commented 5 years ago

As said there, I don't think we can automatically do this. We might with some new configuration in the toml file that specifies that the type of callback parameter X is the same type as function parameter Y, or something like that.

EPashkin commented 5 years ago

@sdroege That we can do automatically? IMHO we have stable rule: it type is final - then use it directly if not - use IsA and this not depend on it parameter number.

EPashkin commented 5 years ago

Oh, you meant that we can't detect real type of closure.

sdroege commented 5 years ago

Yes, we can't know that e.g. the first parameter of the closure is the same as some parameter of the function, e.g. &self. So we can't know a more specific type for it other than what is provided by the .gir file.