-
-
Notifications
You must be signed in to change notification settings - Fork 88
In glib_object_wrapper!, use generic Class type instead defining a struct #10
Conversation
83b4469
to
09ead62
Compare
Can you rebase on top of latest master? Then we get CI back :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me otherwise. Thanks a lot!
09ead62
to
38a946d
Compare
…ruct This makes the `$rust_class_name` argument in `glib_wrapper!` optional. If specified, it defines a `type` alias for the class. At least optionally allowing it is required to avoid breaking lots of gir generated code, but perhaps it can be removed after a change to gir. This removes the `ObjectType::RustClassType` associated type, since it can't be enforced/assumed by the type system that that is an instance of this generic struct. The `IsClassFor` trait is also removed, superseded by this generic type. This also changes the `IsSubclassable` trait to be implemented on the object struct rather than the class struct, since there otherwise would be foreign trait on foreign type errors.
38a946d
to
08731f2
Compare
I'll merge this later today or tomorrow once I've updated |
Thanks! |
|
||
match fn { | ||
get_type => || $get_type_expr:expr, | ||
} | ||
) => { | ||
$crate::glib_object_wrapper!(@object [$($attr)*] $name, $ffi_name, ::std::os::raw::c_void, $rust_class_name, @get_type $get_type_expr, @extends [], @implements []); | ||
$crate::glib_object_wrapper!(@object [$($attr)*] $name, $ffi_name, ::std::os::raw::c_void, @get_type $get_type_expr, @extends [], @implements []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ids1024 Can you also do the gir
change that makes it use the new variants without the explicit class name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't look complicated to update gir
, but I'm seeing issues running generator.py
with gir
master similar to those mentioned in #11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, something's broken currently. Can you create an issue for gir otherwise?
That's waiting here now https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/621 |
08731f2
to
e260e69
Compare
This makes it easier/safer to implement `IsSubclassable`.
e260e69
to
ab67eb8
Compare
This is possible due to gtk-rs/gtk3-rs#10
This is possible due to gtk-rs/gtk3-rs#10
This is possible due to gtk-rs/gtk3-rs#10
Regenerate with latest gir
groovy update: regenerate
Update of gtk-rs/glib#720 with corresponding changes to other crates.
This makes the
$rust_class_name
argument inglib_wrapper!
optional. If specified, it defines atype
alias for the class. At least optionally allowing it is required to avoid breaking lots of gir generated code, but perhaps it can be removed after a change to gir.This removes the
ObjectType::RustClassType
associated type, since it can't be enforced/assumed by the type system that that is an instance of this generic struct.The
IsClassFor
trait is also removed, superseded by this generic type.This also changes the
IsSubclassable
trait to be implemented on the object struct rather than the class struct, since there otherwise would be foreign trait on foreign type errors.