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_countwhen using varcall. The current implementation aims for tuples to still be used instead of aVecfor paramsDefaultTorOption<T>, but I'm not sure if that's possible. This requirement also means that the itests are currently brokenTODO
FromVariantforOption<T>. Needed since things likeOption<i32>are not valid. Could also just be an impl just for primitive Godot typesDefaultforimpl_varcall_signature_for_tuple?#[func(defaults = [...]]macro to varcalls?