Brussels / 2 & 3 February 2019

schedule

GObject subclassing in Rust for extending GTK+ & GStreamer

Or: How to safely implement subclassing in Rust while making use of a C library


Many commonly used libraries from other languages, especially GUI toolkits, make use of Object Oriented Programming (OOP). While Rust has support for many of the OOP concepts in one way or another, there is no easy way for implementing subclassing or inheritance.

The topic of this talk will be how to implement subclassing and inheritance in safe Rust, based on the GObject C library. The GObject library is providing Java/ObjectiveC-style OOP features to C. It is used by the GTK+ UI toolkit, the GStreamer multimedia framework and various GNOME libraries.

Apart from reasons why you would want to do this in Rust, this talk will cover the new implementation for subclassing that was recently integrated into the existing GLib/GObject, GTK+ and GStreamer bindings. These bindings allowed usage of existing GObject types before, but didn't provide any features to create new GObject types. In addition to usage of the subclassing implementation, a couple of details about the implementation will also be explained.

Last but not least, an outlook in the future will be given for how one can take this even one step further with procedural macros to allow writing code that looks very close to Java or C#.

This talk will not only be interesting for those who want to make use of GTK+ or GStreamer and extend those libraries, but will also cover various aspects about safely interfacing with C libraries from Rust and all kinds of type tricks to teach the Rust type-system about subclassing and making use of the type-system for enforcing various invariants at compile-time.

Speakers

Sebastian Dröge

Attachments

Links