Skip to content

Commit 9ef11e8

Browse files
committed
Add groups export.
- Fix docs.
1 parent bb9c28c commit 9ef11e8

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

godot-macros/src/lib.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ use crate::util::{bail, ident, KvParser};
301301
/// ```
302302
///
303303
/// To declare groups and subgroups append `group` key to a `#[export]` attribute. Fields without group will be exported first,
304-
/// followed by properties with subgroup only, tailed by ones with group declaration.
304+
/// followed by properties with group only, tailed by ones with group & subgroup declarations. Relative order of fields is being preserved
305305
///
306306
///```
307307
/// # use godot::prelude::*;
@@ -316,17 +316,29 @@ use crate::util::{bail, ident, KvParser};
316316
/// #[export]
317317
/// will_be_displayed_as_1st: i64,
318318
///
319-
/// #[export(subgroup = "my_other_subgroup_with_no_group")]
320-
/// will_be_displayed_as_the_2nd: i64,
319+
/// #[export(group = "my_other_group")]
320+
/// will_be_displayed_as_the_3rd: i64,
321321
///
322322
/// #[export(range = (0.0, MAX_HEALTH), group = "my_group")]
323-
/// will_be_displayed_as_3rd: f64,
323+
/// will_be_displayed_as_2nd: f64,
324324
///
325325
/// #[export(group = "last_group")]
326326
/// will_be_displayed_last: i64
327327
/// }
328328
///```
329-
///
329+
///
330+
/// Using subgroup with no group specified is not allowed and will result in compile error.
331+
///
332+
/// ```compile_fail
333+
/// # use godot::prelude::*;
334+
///
335+
/// #[derive(GodotClass)]
336+
/// # #[class(init)]
337+
/// struct MyStruct {
338+
/// #[export(subgroup = "my_subgroup")]
339+
/// illegal: u32,
340+
/// ```
341+
///
330342
/// ## Low-level property hints and usage
331343
///
332344
/// You can specify custom property hints, hint strings, and usage flags in a `#[var]` attribute using the `hint`, `hint_string`

0 commit comments

Comments
 (0)