-
-
Notifications
You must be signed in to change notification settings - Fork 198
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
Default func params from Godot #380
Conversation
for actually passing default values.
…count, update default func param tests to test happy path first
API docs are being generated and will be shortly available at: https://godot-rust.github.io/docs/gdext/pr-380 |
I think it may be better to change the signatures to look something like: (R, (P1, P2, ...), (D1, D2, ...)) Where struct Signature<
RETURN_TYPE,
REQUIRED_ARGS,
DEFAULT_ARGS,
const HAS_VARARGS: bool
> {
...
} That way we can distinguish between a function like (This would likely also involve changing the traits to have new type aliases for the default arguments) |
@you-win are you still interested in pursuing this? I have to refactor the proc-macros file structure a bit, so there might be some merge conflicts upcoming... |
I can rebase my PR based off of the refactor, no worries. Edit: If someone wants to salvage this PR, please feel free to do so. I'm admittedly busy with other things |
Any update on this one? The more we wait, the more the code will diverge and introduce conflicts 🙈 |
Since there hasn't been an update since August and the PR had significantly diverged from |
Heavily WIP and might not even be desirable.
Adds the ability to omit parameters when calling Rust methods from GDScript and also have default parameters show up in the GDScript bindings.
This does not actually pass any default values from GDScript. The responsibility is still on the developer to provide their own default values.
Notable changes
arg_count
when using varcall. The current implementation aims for tuples to still be used instead of aVec
for paramsDefault
T
orOption<T>
, but I'm not sure if that's possible. This requirement also means that the itests are currently brokenTODO
FromVariant
forOption<T>
. Needed since things likeOption<i32>
are not valid. Could also just be an impl just for primitive Godot typesDefault
forimpl_varcall_signature_for_tuple
?#[func(defaults = [...]]
macro to varcalls?