-
-
Notifications
You must be signed in to change notification settings - Fork 107
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
Problem with generating enums/flags where the get_type()
function was added later
#839
Comments
"a" and "b" IMHO fixing by changing GstVideo-1.0.gir, |
Alternative also needed fixes for "a" and "b" anyway. |
Probably, but would we even generate the b) for the -sys crate?
We can't implement our own |
About "b": IMHO get_type is normal function so "[cfg]" will be generated with right .gir file. You right that instead not generating we can add "[cfg]" to trait "StaticType" etc. "Breaking change" alternative just increase enum version to match get_type's. |
About "b" if you meant "inverse function" then seems we can't generate it 😢 |
That's not an option for GStreamer unfortunately :) |
Ok, so we have a plan I guess. |
…) functions in sys mode We shouldn't look for the full get_type function name but for the name without the namespace and type name prefix. Once we have that, make use of the ignore and version configuration in addition to the general #[cfg] handling. This allows us to ignore get_type() functions and override their version, for example if the get_type() function was added after the type like in Pango. First part of gtk-rs#839
…) functions in sys mode We shouldn't look for the full get_type function name but for the name without the namespace and type name prefix. Once we have that, make use of the ignore and version configuration in addition to the general #[cfg] handling. This allows us to ignore get_type() functions and override their version, for example if the get_type() function was added after the type like in Pango. First part of gtk-rs#839
…) functions in sys mode We shouldn't look for the full get_type function name but simply for "get_type". As there is only the associated C function name we simply define "get_type" as the name to look for in the configuration. Once we have that, make use of the ignore and version configuration in addition to the general #[cfg] handling. This allows us to ignore get_type() functions and override their version, for example if the get_type() function was added after the type like in Pango. First part of gtk-rs#839
And only make use of the functions conditionally if they're newer than the type itself. This only applies to records (boxed/shared), enums and flags. GObject types always need a get_type function and won't work without, so there will never be the case that the function is added later. Fixes gtk-rs#839
And only make use of the functions conditionally if they're newer than the type itself. This only applies to records (boxed/shared), enums and flags. GObject types always need a get_type function and won't work without, so there will never be the case that the function is added later. Fixes gtk-rs#839
E.g. https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/blob/master/gstreamer-video-sys/src/lib.rs#L2332
This
get_type()
function was added in 1.16, the corresponding flags type exists since much longer.There are two problems here
a) In GStreamer this function needs to be marked as
Since: 1.16
b) We need to generate the
#[cfg()]
thing for it in the -sys cratec) We need to figure out how to handle that conditional compilation in the non-sys crate
Thoughts?
The text was updated successfully, but these errors were encountered: