gtk-rs / glib

DEPRECATED, use https://github.com/gtk-rs/gtk-rs-core repository instead!
http://gtk-rs.org/
MIT License
93 stars 62 forks source link

In glib_object_wrapper!, use generic Class type instead defining a struct #720

Closed ids1024 closed 4 years ago

ids1024 commented 4 years ago

This makes the $rust_class_name argument in glib_wrapper! optional. If specified, it defines a type alias for the class.

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.

TODO: I still need to determine the naming and where this should be exported (should Class be called something else? should it be in the prelude?). I'll also have to try updating gtk to use this (if nothing else, the IsSubclassable implementations will need to be changed).

Fixes https://github.com/gtk-rs/glib/issues/707.

sdroege commented 4 years ago

Thanks, I'll go through this tomorrow :)

GuillaumeGomez commented 4 years ago

Hey @ids1024 ! We migrated the glib crate into gtk-rs/gtk-rs repository. Could you please reopen your PR there? :)