gtk-rs / gir

Tool to generate rust bindings and user API for glib-based libraries
https://gtk-rs.org/gir/book/
MIT License
230 stars 102 forks source link

Change &str input args into impl IntoGStr #1448

Open jf2048 opened 1 year ago

jf2048 commented 1 year ago

Also changes strings with transfer=full to impl Into<GString>

I added new Bounds ~but not a new Transformation, if anything else requires this stack-callback approach then one could be added~

Also added Transformation too to correspond to the new chunk type, so IntoStrV works as well

sdroege commented 1 year ago

Same question here, can you create a draft PR with the changes this causes? :)

sdroege commented 1 year ago

There's also impl Into<GString> for the transfer-full case and impl IntoStrV for the "array of strings" case that would be useful to consider here.

sdroege commented 1 year ago

analysis: Don't use IntoGStr for string params with length

Why not?

jf2048 commented 1 year ago

I added IntoStrV but I think we want to do https://github.com/gtk-rs/gtk-rs-core/issues/978 first, I don't want to make gir subtract one from len() only to remove that later

jf2048 commented 1 year ago

Why not?

Those don't need to be nul terminated, it's fine for them to just be &str. I mean, I guess it could be AsRef<str> if we wanted

sdroege commented 1 year ago

I added IntoStrV but I think we want to do gtk-rs/gtk-rs-core#978 first, I don't want to make gir subtract one from len() only to remove that later

https://github.com/gtk-rs/gtk-rs-core/pull/1037

Those don't need to be nul terminated, it's fine for them to just be &str. I mean, I guess it could be AsRef<str> if we wanted

Oh right, that makes sense.

sdroege commented 1 year ago

I think the futures change would be worth its own PR. That can be merged already :)