Open Ekleog opened 4 years ago
Seems type PixelFormat=u32
used only as return value, it seems can overridden with any type that implement FromGlib<u32>
See as example:
https://github.com/gtk-rs/gtk/blob/master/Gir.toml#L928
https://github.com/gtk-rs/gtk/blob/master/src/auto/dialog.rs#L761
I'm also doing something like that with ClockTime
in gstreamer-rs: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/blob/79b748feb08637729dc9a8485b492cfdb7796478/Gir_Gst.toml#L187
Ah, interesting. I wasn't aware of the conversion_type
config key. But that seems to does the trick. Thanks for the info!
/edit: Note that the type is also used as parameter to Camera::set_pixel_format
, so we'll have to implement ToGlib
too. But that's no issue :)
So nothing needed here or do you still see a possible improvement?
I suppose it would be nice to have conversion_type
documented. But the functionality we needed is already present :)
Hello,
In the process of https://github.com/robohouse-delft/aravis-rs/issues/2, it looks like it'd be very useful if gir made it possible to manually implement primitive type aliases. This way, it could be defined as a
#[repr(transparent)]
struct, that could then gain associated constants, etc.In particular for https://github.com/robohouse-delft/aravis-rs/issues/2, it'd be useful so as to implement an “open” enum, where the defined values are not the only ones that could be valid, depending on the specific hardware considered — basically, some values have names, but even unnamed values can have meaning.
Do you think it'd be possible to implement in gir?
Cheers, and thank you for gir and gtk-rs :3