Skip to content

Commit 88226cb

Browse files
authored
Added note about the export attribute rename (#68)
1 parent 0624e9b commit 88226cb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/rust-binding/methods.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
In order to receive data from Godot, you can export methods. With the `#[export]` attribute, godot-rust takes care of method registration and serialization. Note that the constructor is not annotated with `#[export]`.
44

5+
> #### Upcoming API changes
6+
> `#[export]` is being renamed as `#[godot]` and will soon be deprecated, and later removed in godot-rust 0.11.
7+
>
8+
> For more information, see [gdnative::derive::NativeClass](https://godot-rust.github.io/docs/gdnative/derive/derive.NativeClass.html).
9+
510
The exported method's first parameter is always `&self` or `&mut self` (operating on the Rust object), and the second parameter is `&T` or `TRef<T>` (operating on the Godot base object, with `T` being the inherited type).
611

712
```rust
@@ -137,4 +142,4 @@ fn _to_string(&self, _owner: &Reference) -> String {...}
137142

138143
If you pass arguments from GDScript that are incompatible with the Rust method's signature, the method invocation will fail. In this case, the code inside the method is not executed. An error message is printed on the Godot console, and the value `null` is returned for the GDScript function call.
139144

140-
If code inside your method panics (e.g. by calling `unwrap()` on an empty option/result), the same happens: error message and return value `null`.
145+
If code inside your method panics (e.g. by calling `unwrap()` on an empty option/result), the same happens: error message and return value `null`.

0 commit comments

Comments
 (0)