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

Prevent all the copies in FFI translation by having Rust types for GLib arrays, strings, hash table, lists, etc #48

Closed
sdroege opened this issue Sep 5, 2017 · 5 comments
Labels
enhancement New feature or request glib
Milestone

Comments

@sdroege
Copy link
Member

sdroege commented Sep 5, 2017

See above. Those could implement all kinds of conversions to the actual Rust types, e.g. via Iterator::collect() for arrays, but use the GLib allocator for memory management.

These could be used for the "transfer full" return values (and out parameters) everywhere at least.

For "transfer none" we could at least automatically support 'static references. Non-static borrowing requires a lot of knowledge of the API and is better implemented manually.

@EPashkin
Copy link
Member

EPashkin commented Sep 5, 2017

It may be good.

@sdroege
Copy link
Member Author

sdroege commented Jun 19, 2019

For Strings, @philn implemented GString which does exactly that. Now only everything else is missing :)

@sdroege sdroege transferred this issue from gtk-rs/glib Nov 9, 2020
elmarco referenced this issue in elmarco/gtk-rs Feb 10, 2021
@GuillaumeGomez GuillaumeGomez transferred this issue from gtk-rs/gtk3-rs May 14, 2021
@sdroege sdroege added enhancement New feature or request glib labels May 18, 2021
@sdroege sdroege added this to the 0.16.0 milestone Aug 22, 2022
@jf2048
Copy link
Member

jf2048 commented Oct 9, 2022

Currently have: PtrSlice, Slice, PtrArray, List, SList, GString

Still missing: Array, HashTable

@sdroege
Copy link
Member Author

sdroege commented Oct 9, 2022

Also missing: making use of these from the code generator :)

Still missing: Array, HashTable

These are hard (or impossible) to do right, see https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/305

@sdroege sdroege modified the milestones: 0.16.0, 0.17.0 Oct 9, 2022
@sdroege
Copy link
Member Author

sdroege commented Jan 21, 2023

For arrays (including string arrays) and lists there are container types now. As mentioned above, the others are unfortunately hard to deal with and better handled by copying and on a case-by-case basis.

@sdroege sdroege closed this as completed Jan 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request glib
Projects
None yet
Development

No branches or pull requests

3 participants