Skip to content

Use TryFromGlib for *Return types

While working on #234 (closed), a new trait TryFromGlib was defined in gtk-rs/glib so that glib types with an undefined value could be constructed as an Option<T>. As a generalization TryFromGlib can also convert eligible glib types to Rust Result<*Success, *Error> types.

gir is being modified in order to handle types implementing TryFromgGlib in generated code. This is an opportunity to take advantage of this new feature to automatically generate functions which rely on *Return types. In Rust, these types benefit from the Result<*Success, *Error> representation.

This MR uses the gir un-merged changes so that the we can auto-generate some functions which benefit from Result<*Success, *Error> as a return value or as an argument.

Edited by François Laignel

Merge request reports

Loading