Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bilelmoussaoui opened this issue Dec 9, 2022 · 0 comments
Open

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

bilelmoussaoui opened this issue Dec 9, 2022 · 0 comments

Comments

@bilelmoussaoui
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant