Skip to content

Commit 96916fa

Browse files
committed
Various smaller doc improvements + links
1 parent f6232ce commit 96916fa

File tree

6 files changed

+16
-7
lines changed

6 files changed

+16
-7
lines changed

godot-core/src/builtin/math/float.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ mod private {
1616
impl Sealed for f64 {}
1717
}
1818

19+
/// Trait that provides Godot math functions as extensions on `f32` and `f64`.
1920
pub trait FloatExt: private::Sealed + Copy {
2021
const CMP_EPSILON: Self;
2122

godot-core/src/meta/godot_convert/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ pub trait GodotConvert {
4040
/// Violating these assumptions is safe but will give unexpected results.
4141
///
4242
/// Please read the [`godot::meta` module docs][crate::meta] for further information about conversions.
43+
///
44+
/// This trait can be derived using the [`#[derive(GodotConvert)]`](../register/derive.GodotConvert.html) macro.
4345
pub trait ToGodot: Sized + GodotConvert {
4446
/// Target type of [`to_godot()`](ToGodot::to_godot), which can differ from [`Via`][GodotConvert::Via] for pass-by-reference types.
4547
///
@@ -72,6 +74,8 @@ pub trait ToGodot: Sized + GodotConvert {
7274
/// Violating these assumptions is safe but will give unexpected results.
7375
///
7476
/// Please read the [`godot::meta` module docs][crate::meta] for further information about conversions.
77+
///
78+
/// This trait can be derived using the [`#[derive(GodotConvert)]`](../register/derive.GodotConvert.html) macro.
7579
pub trait FromGodot: Sized + GodotConvert {
7680
/// Converts the Godot representation to this type, returning `Err` on failure.
7781
fn try_from_godot(via: Self::Via) -> Result<Self, ConvertError>;

godot-core/src/registry/property.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ use crate::meta::{ClassName, FromGodot, GodotConvert, GodotType, PropertyHintInf
1414
// ----------------------------------------------------------------------------------------------------------------------------------------------
1515
// Trait definitions
1616

17-
/// Trait implemented for types that can be used as `#[var]` fields.
17+
// Note: HTML link for #[var] works if this symbol is inside prelude, but not in register::property.
18+
/// Trait implemented for types that can be used as [`#[var]`](../register/derive.GodotClass.html#properties-and-exports) fields.
1819
///
1920
/// This creates a copy of the value, according to copy semantics provided by `Clone`. For example, `Array`, `Dictionary` and `Gd` are
2021
/// returned by shared reference instead of copying the actual data.
@@ -45,7 +46,8 @@ pub trait Var: GodotConvert {
4546
}
4647
}
4748

48-
/// Trait implemented for types that can be used as `#[export]` fields.
49+
// Note: HTML link for #[export] works if this symbol is inside prelude, but not in register::property.
50+
/// Trait implemented for types that can be used as [`#[export]`](../register/derive.GodotClass.html#properties-and-exports) fields.
4951
///
5052
/// `Export` is only implemented for objects `Gd<T>` if either `T: Inherits<Node>` or `T: Inherits<Resource>`, just like GDScript.
5153
/// This means you cannot use `#[export]` with `Gd<RefCounted>`, for example.

godot-macros/src/derive/derive_godot_convert.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* License, v. 2.0. If a copy of the MPL was not distributed with this
55
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
66
*/
7+
78
use crate::derive::data_models::GodotConvert;
89
use crate::derive::{make_fromgodot, make_togodot};
910
use crate::ParseResult;

godot-macros/src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ use crate::util::{bail, ident, KvParser};
148148
/// [properties](https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_basics.html#properties-setters-and-getters)
149149
/// (fields with a `get` or `set` declaration) and
150150
/// [exports](https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_exports.html)
151-
/// (fields annotated with `@export`). In the gdext API, these two concepts are represented with `#[var]` and `#[export]` attributes respectively.
151+
/// (fields annotated with `@export`). In the gdext API, these two concepts are represented with `#[var]` and `#[export]` attributes respectively,
152+
/// which in turn are backed by the [`Var`](../register/property/trait.Var.html) and [`Export`](../register/property/trait.Export.html) traits.
152153
///
153154
/// ## Property registration
154155
///
@@ -846,9 +847,9 @@ pub fn godot_dyn(_meta: TokenStream, input: TokenStream) -> TokenStream {
846847
translate(input, class::attribute_godot_dyn)
847848
}
848849

849-
/// Derive macro for [`GodotConvert`](../builtin/meta/trait.GodotConvert.html) on structs.
850+
/// Derive macro for [`GodotConvert`](../meta/trait.GodotConvert.html) on structs.
850851
///
851-
/// This derive macro also derives [`ToGodot`](../builtin/meta/trait.ToGodot.html) and [`FromGodot`](../builtin/meta/trait.FromGodot.html).
852+
/// This derive macro also derives [`ToGodot`](../meta/trait.ToGodot.html) and [`FromGodot`](../meta/trait.FromGodot.html).
852853
///
853854
/// # Choosing a Via type
854855
///
@@ -979,7 +980,7 @@ pub fn derive_godot_convert(input: TokenStream) -> TokenStream {
979980

980981
/// Derive macro for [`Var`](../register/property/trait.Var.html) on enums.
981982
///
982-
/// This expects a derived [`GodotConvert`](../builtin/meta/trait.GodotConvert.html) implementation, using a manual
983+
/// This expects a derived [`GodotConvert`](../meta/trait.GodotConvert.html) implementation, using a manual
983984
/// implementation of `GodotConvert` may lead to incorrect values being displayed in Godot.
984985
#[proc_macro_derive(Var, attributes(godot))]
985986
pub fn derive_var(input: TokenStream) -> TokenStream {

godot/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
//! * **`codegen-rustfmt`**
108108
//!
109109
//! Use rustfmt to format generated binding code. Because rustfmt is so slow, this is detrimental to initial compile time.
110-
//! Without it, we use a lightweight and fast custom formatter to enable basic human readability.
110+
//! Without it, we use a lightweight and fast custom formatter to enable basic human readability.<br><br>
111111
//!
112112
//! * **`register-docs`**
113113
//!

0 commit comments

Comments
 (0)