GDScript -> Rust calls: parameter and return type conversions #125
Labels
c: register
Register classes, functions and other symbols to GDScript
feature
Adds functionality to the library
We need to work out rules regarding how values from and to Rust
#[func]
methods are passed, when invoked from GDScript. Most notably, we should decide which implicit conversions (if at all) we provide. Then, we should test those, and make sure unwanted conversions don't happen (and panic instead).Generally I'd like an approach where we start quite restrictive, and then can loosen restrictions on a demand basis. This not only avoids bugs and makes things more explicit, but it also prevents performance traps where someone passes
Array
to aVec
, needing reallocation and copying each frame.Or we keep type-safety, but provide tooling to avoid excessive user-side converting.
Examples:
int
f32
float
i32
float
u32
String
std::string::String
StringName
std::string::String
Array
Array<i32>
Array
Array<Variant>
Array
Vec<Variant>
Array[int]
Array<i32>
Array[int]
Array<Variant>
...
Variant
...
Option<T>
...
Result<T, E>
The text was updated successfully, but these errors were encountered: