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

data parameter for gio::content_type_guess should be an Option #1133

Open
euclio opened this issue May 9, 2021 · 3 comments · May be fixed by #1551
Open

data parameter for gio::content_type_guess should be an Option #1133

euclio opened this issue May 9, 2021 · 3 comments · May be fixed by #1551

Comments

@euclio
Copy link
Contributor

euclio commented May 9, 2021

According to the documentation, NULL is a valid value for the data parameter of g_content_type_guess. However, the Rust bindings type it as &[u8], making it impossible to pass a null value.

@sdroege sdroege transferred this issue from gtk-rs/gtk3-rs May 9, 2021
@sdroege
Copy link
Member

sdroege commented May 9, 2021

Seems like gir does not handle nullability annotations correctly in combination with arrays.

@euclio
Copy link
Contributor Author

euclio commented May 10, 2021

Yep, I managed to track it down to this line. Not sure if it's safe to remove completely or if it needs to be smarter, though.

@sdroege
Copy link
Member

sdroege commented May 11, 2021

It should almost work, but in addition you will also need to carry through the nullability in TransformationType::Length so that inside src/codegen/function_body_chunk.rs it does array.map(|array| array.len()).unwrap_or(0) instead of array.len().

Want to give it a try?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants