1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//! The [`Component`] type — registered via [`crate::Installer::add_component`]
//! for optional wizard/CLI-selectable install features.
/// An optional feature the user can select or deselect at install time.
///
/// Registered via [`crate::Installer::add_component`]. The component's progress weight
/// contributes to the installer's step total whenever the component is
/// selected; operations performed while the component is active each advance
/// the cursor by their own weight (default 1).
///
/// ```rust,ignore
/// i.add_component("docs", "Documentation", "User-facing docs", 3);
/// i.add_component("core", "Core files", "Always installed", 10).required();
/// // Opt-in component: register, then deselect.
/// i.add_component("extras", "Extras", "Optional samples", 1);
/// i.set_component_selected("extras", false);
/// ```
///
/// Query with [`crate::Installer::is_component_selected`] inside the install
/// callback to branch on user choice.