-
-
Notifications
You must be signed in to change notification settings - Fork 199
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
#[derive(Property, Export)] for enums #371
#[derive(Property, Export)] for enums #371
Conversation
API docs are being generated and will be shortly available at: https://godot-rust.github.io/docs/gdext/pr-371 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for this! 👍
Really nice that you even added generic support! Do you think it's possible to list one generic example in the test as well, to make sure the syntax is parsed correctly and works?
itest/rust/src/property_test.rs
Outdated
assert_eq!(class.get_foo(), Test::B as i64); | ||
class.set_foo(Test::C as i64); | ||
assert_eq!(class.foo, Test::C); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it's possible that get_foo/set_foo
return/accept directly the enum in Rust, not the i64
?
Although maybe that's more complex; in that case it could be done later as a QoL improvement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scope of this PR is more to add the proc macros than to modify library code - I'm not saying I won't be doing this or that it's completely outside the scope of this PR, but this is definitely not a priority for me rn.
Aside from the stuff I resolved in the reviews (if it's not resolved feel free to reopen), I removed generic support (since it's not usable in any way right now). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some superficial comments about the new changes, will probably need another look tomorrow...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot! The CI fails due to memory leaks, see first comment for addressing them.
After addressing the remaining comments and green CI, it should be good to go, so you could already squash the commits!
Initial work for #[derive(Property)] (failing) general fixing around make proper tests for derive(Property) review stuff tm remove default repr type since isize isnt GodotFfi this is what happens when i try to commit too fast again Documentation + review fixes implement and document Export add a test for derive(Export) review fixing ci fixes further fixing oopsies
64468b2
to
e44194a
Compare
Thank you! 👍 |
MVP macros for deriving Property and Export in enums.
Not done yet, but hoping for reviews since this is my first contribution to a library of this size.
Commits will be squashed later, please review as one for now.
Current requirements for deriving these traits:
#[repr(i*/u*)]
typeA = 2
instead ofA(u32) = 2
orA
)From earlier attempts, it seemed like ToVariant and FromVariant were needed as well? Doesn't seem to be the case anymore, weirdly.
TODO list:
#[derive(Property)]
#[derive(Export)]