Static methods and custom constructors on custom types #175
Labels
c: register
Register classes, functions and other symbols to GDScript
feature
Adds functionality to the library
Question/Feature Request
Is there a way to define methods on your custom types in Rust which do not take a
self
parameter?A minimal example of how I would expect it to work:
But, I currently get a somewhat cryptic error from the macro:
Use case for this would be static methods and constructors that actually take arguments.
This would ideally be called from GdScript like
MyType.from_foo(foo)
which constructs aMyType
from afoo
.There is godotengine/godot#61963 which seems to suggest it's supported by gdextension, but I haven't found a way to do it in Rust using this repo.
There's also #43 which looks like the other direction, exposing static methods on Godot types in Rust.
The text was updated successfully, but these errors were encountered: