Open
Description
We should implement a ZST type that can be used as a field, like gdnative's Property<T>
.
This type will not store any value itself, but delegate to the custom getter and setter.
Example:
#[derive(GodotClass)]
struct MyClass {
#[var(get)]
synthetic_string: Property<GString>,
}
#[godot_api]
impl MyClass {
#[func]
fn get_synthetic_string(&self) -> GString {
// Derive on-the-fly from instance state.
}
}
I originally thought this might be interesting as a workaround for #[constant]
which is limited to integers. However, properties make impractical constants as they need a pre-existing instance. Static functions are better suited.