@@ -22,7 +22,27 @@ use crate::util::ident;
2222// Below intra-doc link to the trait only works as HTML, not as symbol link.
2323/// Derive macro for [`GodotClass`](../obj/trait.GodotClass.html) on structs.
2424///
25- /// You must use this macro; manual implementations of the `GodotClass` trait are not supported.
25+ /// You should use this macro; manual implementations of the `GodotClass` trait are not encouraged.
26+ ///
27+ /// This is typically used in combination with [`#[godot_api]`](attr.godot_api.html), which can implement custom functions and constants,
28+ /// as well as override virtual methods.
29+ ///
30+ /// See also [book chapter _Registering classes_](https://godot-rust.github.io/book/register/classes.html).
31+ ///
32+ /// **Table of contents:**
33+ /// - [Construction](#construction)
34+ /// - [Inheritance](#inheritance)
35+ /// - [Properties and exports](#properties-and-exports)
36+ /// - [Property registration](#property-registration)
37+ /// - [Property exports](#property-exports)
38+ /// - [Signals](#signals)
39+ /// - [Further class customization](#further-class-customization)
40+ /// - [Running code in the editor](#running-code-in-the-editor)
41+ /// - [Editor plugins](#editor-plugins)
42+ /// - [Class renaming](#class-renaming)
43+ /// - [Class hiding](#class-hiding)
44+ /// - [Further field customization](#further-field-customization)
45+ /// - [Fine-grained inference hints](#fine-grained-inference-hints)
2646///
2747///
2848/// # Construction
@@ -117,12 +137,15 @@ use crate::util::ident;
117137///
118138/// # Properties and exports
119139///
140+ /// See also [book chapter _Registering properties_](https://godot-rust.github.io/book/register/properties.html#registering-properties).
141+ ///
120142/// In GDScript, there is a distinction between
121143/// [properties](https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_basics.html#properties-setters-and-getters)
122144/// (fields with a `get` or `set` declaration) and
123145/// [exports](https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_exports.html)
124- /// (fields annotated with `@export`). In the GDExtension API, these two concepts are represented with
125- /// `#[var]` and `#[export]` attributes respectively.
146+ /// (fields annotated with `@export`). In the gdext API, these two concepts are represented with `#[var]` and `#[export]` attributes respectively.
147+ ///
148+ /// ## Property registration
126149///
127150/// To create a property, you can use the `#[var]` annotation:
128151///
@@ -190,6 +213,8 @@ use crate::util::ident;
190213/// }
191214/// ```
192215///
216+ /// ## Property exports
217+ ///
193218/// For exporting properties to the editor, you can use the `#[export]` attribute:
194219///
195220/// ```
@@ -314,7 +339,9 @@ use crate::util::ident;
314339/// }
315340/// ```
316341///
317- /// # Running code in the editor
342+ /// # Further class customization
343+ ///
344+ /// ## Running code in the editor
318345///
319346/// If you annotate a class with `#[class(tool)]`, its lifecycle methods (`ready()`, `process()` etc.) will be invoked in the editor. This
320347/// is useful for writing custom editor plugins, as opposed to classes running simply in-game.
@@ -324,7 +351,7 @@ use crate::util::ident;
324351///
325352/// This is very similar to [GDScript's `@tool` feature](https://docs.godotengine.org/en/stable/tutorials/plugins/running_code_in_the_editor.html).
326353///
327- /// # Editor plugins
354+ /// ## Editor plugins
328355///
329356/// If you annotate a class with `#[class(editor_plugin)]`, it will be turned into an editor plugin. The
330357/// class must then inherit from `EditorPlugin`, and an instance of that class will be automatically added
@@ -338,7 +365,7 @@ use crate::util::ident;
338365/// This should usually be combined with `#[class(tool)]` so that the code you write will actually run in the
339366/// editor.
340367///
341- /// # Class renaming
368+ /// ## Class renaming
342369///
343370/// You may want to have structs with the same name. With Rust, this is allowed using `mod`. However in GDScript,
344371/// there are no modules, namespaces, or any such disambiguation. Therefore, you need to change the names before they
@@ -362,7 +389,7 @@ use crate::util::ident;
362389///
363390/// These classes will appear in the Godot editor and GDScript as "AnimalToad" or "NpcToad".
364391///
365- /// # Hiding classes
392+ /// ## Class hiding
366393///
367394/// If you want to register a class with Godot, but not have it show up in the editor then you can use `#[class(hide)]`.
368395///
@@ -376,7 +403,9 @@ use crate::util::ident;
376403/// Even though this class is a `Node` and it has an init function, it still won't show up in the editor as a node you can add to a scene
377404/// because we have added a `hide` key to the class. This will also prevent it from showing up in documentation.
378405///
379- /// # Fine-grained inference hints
406+ /// # Further field customization
407+ ///
408+ /// ## Fine-grained inference hints
380409///
381410/// The derive macro is relatively smart about recognizing `Base<T>` and `OnReady<T>` types, and works also if those are qualified.
382411///
@@ -415,18 +444,20 @@ pub fn derive_godot_class(input: TokenStream) -> TokenStream {
415444
416445/// Proc-macro attribute to be used with `impl` blocks of [`#[derive(GodotClass)]`][GodotClass] structs.
417446///
447+ /// See also [book chapter _Registering functions_](https://godot-rust.github.io/book/register/functions.html) and following.
448+ ///
418449/// Can be used in two ways:
419450/// ```no_run
420451/// # use godot::prelude::*;
421452/// #[derive(GodotClass)]
422453/// #[class(init, base=Node)]
423454/// struct MyClass {}
424455///
425- /// // 1) inherent impl block: user-defined, custom API
456+ /// // 1) inherent impl block: user-defined, custom API.
426457/// #[godot_api]
427458/// impl MyClass { /* ... */ }
428459///
429- /// // 2) trait impl block: implement Godot-specific APIs
460+ /// // 2) trait impl block: implement Godot-specific APIs.
430461/// #[godot_api]
431462/// impl INode for MyClass { /* ... */ }
432463/// ```
@@ -635,8 +666,7 @@ pub fn bench(meta: TokenStream, input: TokenStream) -> TokenStream {
635666
636667/// Proc-macro attribute to be used in combination with the [`ExtensionLibrary`] trait.
637668///
638- /// [`ExtensionLibrary`]: trait.ExtensionLibrary.html
639- // FIXME intra-doc link
669+ /// [`ExtensionLibrary`]: ../init/trait.ExtensionLibrary.html
640670#[ proc_macro_attribute]
641671pub fn gdextension ( meta : TokenStream , input : TokenStream ) -> TokenStream {
642672 translate_meta (
0 commit comments