Skip to content

Correct group parameter name in Params struct's attribute docs #213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kneitinger
Copy link

@kneitinger kneitinger commented Apr 6, 2025

Summary

This corrects a small error in the Params struct's docs where the attribute that should be group is documented as group_name e.g.

/// ## `#[nested]`, `#[nested(group_name = "group name")]`

Definition of the attribute in the derive crate:

// This one is more complicated. Supports an `array` attribute, an `id_prefix =
// "foo"` attribute, and a `group = "group name"` attribute. All are optional, and
// the first two are mutually exclusive.

)) if path.is_ident("group") => {

Demo

Use of the documented attribute name fails to compile

pub struct NightgrainParams {
    #[persist = "editor-state"]
    pub editor_state: Arc<ViziaState>,

    #[nested(array, group_name = "Grain Parameters")]
    pub grain_params: [Arc<GrainParams>; GRAIN_OSC_COUNT],
}
$ cargo xtask bundle nightgrain                                                                                                                                                                                                        25-04-06 12:29:56 (1)
    Finished `release` profile [optimized] target(s) in 0.06s
     Running `target/release/xtask bundle nightgrain`
   Compiling nightgrain v0.1.0 (/home/leaf/c/music/r/nightgrain/nightgrain)
error: Unknown attribute. See the Params trait documentation for more information.
  --> nightgrain/src/params.rs:23:21
   |
23 |     #[nested(array, group_name = "Grain Parameters")]
   |                     ^^^^^^^^^^

...

Use of the correct attribute name compiles

#[derive(Params)]
pub struct NightgrainParams {
    #[persist = "editor-state"]
    pub editor_state: Arc<ViziaState>,

    #[nested(array, group = "Grain Parameters")]
    pub grain_params: [Arc<GrainParams>; GRAIN_OSC_COUNT],
}
 $ cargo xtask bundle nightgrain                                                                                                                                                                                                        25-04-06 12:33:46 (0)
    Finished `release` profile [optimized] target(s) in 0.06s
     Running `target/release/xtask bundle nightgrain`
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.08s

Created a VST3 bundle at '/home/leaf/c/music/r/nightgrain/target/bundled/nightgrain.vst3'       

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant