Support BoxedInline without a get_type function#1297
Support BoxedInline without a get_type function#1297wash2 wants to merge 6 commits intogtk-rs:mainfrom
Conversation
src/codegen/general.rs
Outdated
| sys_crate_name, | ||
| get_type_fn | ||
| )?; | ||
| if let Some((ref get_type_fn, _get_type_version)) = get_type_fn { |
There was a problem hiding this comment.
This requires a get_type function, or otherwise more changes in glib are needed
There was a problem hiding this comment.
For the case of not BoxedInline but normal Boxed
There was a problem hiding this comment.
So the get_type_fn here can't be None then?
There was a problem hiding this comment.
Well, there won't be a copy/free function here otherwise and that won't compile without further changes in glib
src/library.rs
Outdated
| } | ||
| if let Some(tid) = env.library.find_type(0, &full_name) { | ||
| let gobject_id = env.library.find_type(0, "GObject.Object").unwrap(); | ||
| let gobject_id = env.library.find_type(0, "GObject.Object"); |
There was a problem hiding this comment.
If you don't have GObject in your dependencies then there can't be any class hierarchy at all, so the code below should simply not run
sdroege
left a comment
There was a problem hiding this comment.
Otherwise makes sense.
Why do you want to create bindings for GModule though? I think that's going to require writing the whole bindings manually to end up with anything usable and somewhat safe. The autogenerated bindings won't be usable.
src/codegen/record.rs
Outdated
| &analysis.init_function_expression, | ||
| &analysis.copy_into_function_expression, | ||
| &analysis.clear_function_expression, | ||
| &analysis.glib_get_type, |
There was a problem hiding this comment.
maybe analysis.glib_get_type.map(|ref a,_| a) or something like that to avoid passing the version that's unneeded here ?
I want to use GModule to support "plug-ins" |
The |
Ok, thanks, I'll check that out |
src/codegen/general.rs
Outdated
| copy_into_function_expression: &Option<String>, | ||
| clear_function_expression: &Option<String>, | ||
| get_type_fn: &str, | ||
| get_type_fn: Option<&String>, |
There was a problem hiding this comment.
| get_type_fn: Option<&String>, | |
| get_type_fn: Option<&str>, |
src/codegen/record.rs
Outdated
| &analysis.init_function_expression, | ||
| &analysis.copy_into_function_expression, | ||
| &analysis.clear_function_expression, | ||
| analysis.glib_get_type.as_ref().map(|(ref a, _)| a), |
There was a problem hiding this comment.
| analysis.glib_get_type.as_ref().map(|(ref a, _)| a), | |
| analysis.glib_get_type.as_ref().map(|(ref a, _)| a).as_deref(), |
There was a problem hiding this comment.
Coercion still fails for me with as_deref()
This is my attempt at supporting BoxedInline without a get_type function #1236 #1295. Generating the bindings for gmodule does not panic and now outputs: