gtk-rs / gir

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

codegen: Fix nullable array in function params #1551

Open bilelmoussaoui opened 4 months ago

bilelmoussaoui commented 4 months ago

Co-authored-by: Andy Russell arussell123@gmail.com Fixes #1133

Take over of https://github.com/gtk-rs/gir/pull/1136 except it only generates Option if it is not a return type. To avoid generating Option<Vec<T>>

bilelmoussaoui commented 4 months ago

Ok seems like gir doesn't give us a way to know if the array is zero-terminated or not...that makes it more difficult

sdroege commented 4 months ago

To avoid generating Option<Vec>

Why? That seems like the correct thing to do, even if it's inconvenient.

Ok seems like gir doesn't give us a way to know if the array is zero-terminated or not...that makes it more difficult

It's an attribute in the XML though.

bilelmoussaoui commented 4 months ago

It's an attribute in the XML though.

I know, but it is not parsed nor passed around...

sdroege commented 4 months ago

I know, but it is not parsed nor passed around...

Uh... what?! :rofl:

We assume always that it's zero-terminated unless there is an array length?