gir icon indicating copy to clipboard operation
gir copied to clipboard

Figure out a replacement of AsRef<T> for fundamental types

Open bilelmoussaoui opened this issue 2 years ago • 0 comments

Currently gir, would generate AsRef<T> for fundamental types as a replacement of IsA<T> that is used for objects/interfaces. The problem with using AsRef<T> is it causes problems when the param is passed by value instead of by reference, so having a still generic Option<impl AsRef<T>> would mean having to clone the param before calling into_glib_ptr()

That is sub-optimal and we should probably avoid using AsRef here; maybe an alternative would be to allow configuring a trait to be used for a fundamental type and it sub-types. For example fundamental_trait = "IsExpression or something like that.

Needs more thinking though. Details can be found at https://github.com/gtk-rs/gir/pull/1413/files#r1044662046

bilelmoussaoui avatar Dec 09 '22 17:12 bilelmoussaoui