-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
Rename get_
methods
#963
Comments
I personally think we should try to stick to a mix between rust API guidelines and providing functions with name close to the C ones (to make the search simpler). |
I think this could make sense. We'd have to try with the code generator if that ends up with a nice API or is just confusing in the end, or if there are even conflicts between functions. And we already have this naming scheme in some of the manual API in glib. Also should consider converting @EPashkin What do you think? |
I agree that we can remove "property" for properties, |
So @fengalin created https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/639 and I think this improves the API a lot, making it more Rust-y. I think we should do the same here for gtk-rs: most getters should have their And additionally, we already have many getters in manual code that don't have the @bilelmoussaoui @GuillaumeGomez What do you think? |
Also this should be done together with #962 |
I totally agree on this on renaming both cases. Other language bindings do make the properties usage seamless, for example Python can lets you modify the properties using |
Based on my experience of doing that manually in Edit: @GuillaumeGomez, I followed your advice where possible :) https://gitlab.freedesktop.org/fengalin/gstreamer-rs/-/blob/remove-get_-for-getters/gstreamer/src/buffer.rs#L305 |
What do you mean with that btw? I would've assumed that |
For tracing: see my response to your other comment there. |
@fengalin You're my hero! \o/ And if that doesn't create conflicts, I completely approve. |
This is explicitly mentioned in the Rust style guidelines btw: https://doc.rust-lang.org/1.0.0/style/style/naming/README.html#getter/setter-methods-[rfc-344] . |
The
get_
methods should be renamed to fit the amazing Rust API Guidelines.This would apply to the other crates as well.
Yes, there are a lot of methods, but it would lead to nicer, more rusty code.
Examples
ButtonExt.get_text()
->ButtonExt.text()
LabelExt.get_angle()
->LabelExt.angle()
Perhaps methods like the following could look different?
ButtonExt.get_always_show_image()
->ButtonExt.always_shows_image()
ButtonExt.get_use_underline()
->ButtonExt.uses_underline()
Ehh...probably not.... it's just something to consider.
The text was updated successfully, but these errors were encountered: