Skip to content

Commit 15469d6

Browse files
committed
Hot-reload: enable editor docs
1 parent 0d51aaa commit 15469d6

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

Diff for: hot-reload/godot/project.godot

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ config_version=5
1212

1313
config/name="hot-reload"
1414
run/main_scene="uid://da7eiv1notj7j"
15-
config/features=PackedStringArray("4.4", "Forward Plus")
15+
config/features=PackedStringArray("4.5", "Forward Plus")

Diff for: hot-reload/rust/Cargo.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ publish = false
99
[lib]
1010
crate-type = ["cdylib"]
1111

12-
[dependencies]
13-
godot = { git = "https://github.com/godot-rust/gdext.git" }
12+
[dependencies.godot]
13+
git = "https://github.com/godot-rust/gdext.git"
14+
features = ["register-docs"] # Registers RustDoc comments, so they appear in editor docs.

Diff for: hot-reload/rust/src/lib.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ unsafe impl ExtensionLibrary for HotReload {
2222

2323
// ----------------------------------------------------------------------------------------------------------------------------------------------
2424

25+
/// A RustDoc comment appearing under the editor help docs.
2526
#[derive(GodotClass)]
2627
#[class(base=Node)]
2728
struct Reloadable {
29+
/// A planet!
2830
#[export]
2931
favorite_planet: Planet,
3032
//
@@ -46,11 +48,14 @@ impl INode for Reloadable {
4648

4749
#[godot_api]
4850
impl Reloadable {
49-
#[rustfmt::skip] // easier replacement by test.
51+
/// A function to return a number.
5052
#[func]
51-
// HOT-RELOAD: change returned value for dynamic code change.
52-
fn get_number(&self) -> i64 { 100 }
53+
fn get_number(&self) -> i64 {
54+
// HOT-RELOAD: change returned value for dynamic code change.
55+
100
56+
}
5357

58+
/// Constructor from a string.
5459
#[func]
5560
fn from_string(s: GString) -> Gd<Self> {
5661
Gd::from_object(Reloadable {
@@ -61,6 +66,7 @@ impl Reloadable {
6166

6267
// ----------------------------------------------------------------------------------------------------------------------------------------------
6368

69+
/// A planet enum.
6470
#[derive(GodotConvert, Var, Export)]
6571
#[godot(via = GString)]
6672
enum Planet {

0 commit comments

Comments
 (0)