#[non_exhaustive]pub struct NextStep {
pub text: String,
pub command: Option<String>,
}Expand description
A next-step action recommendation at the end of a report.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.text: String§command: Option<String>Implementations§
Source§impl NextStep
impl NextStep
Sourcepub fn new(text: impl Into<String>) -> Self
pub fn new(text: impl Into<String>) -> Self
Creates a next step recommendation.
Examples found in repository?
examples/report_demo.rs (line 60)
6fn main() {
7 let console = Console::stdout(ColorMode::Auto);
8
9 println!("=== 1. Verdict & Status ===");
10 println!(
11 "{}",
12 Verdict::Passed.render(console, "Configuration validated cleanly")
13 );
14 println!(
15 "{}",
16 Verdict::Warning.render(console, "3 non-critical findings detected")
17 );
18 println!(
19 "{}",
20 Verdict::Failed.render(console, "Build failed: 2 errors")
21 );
22 println!();
23
24 println!("=== 2. Error / Prerequisite Block ===");
25 let err_block = ErrorBlock::new("Required toolchain is unavailable")
26 .with_explanation("The configured version is not installed.")
27 .with_remedy("Install the required toolchain:")
28 .add_command("toolchain install stable");
29 print!("{}", err_block.render(console));
30
31 println!("=== 3. Decision-Oriented Report (Compact) ===");
32 let report = Report::new("Site audit v1.2.0", Verdict::Warning)
33 .add_scope_note(ScopeNote::new(
34 "Scope warnings",
35 vec![
36 "Git history partial".to_string(),
37 "1 file skipped".to_string(),
38 ],
39 ))
40 .add_metric(Metric::new("Errors", "0"))
41 .add_metric(Metric::new("Warnings", "4").with_trend(runemark::Trend::Negative, "+2"))
42 .add_metric(Metric::new("Score", "94/100").with_trend(runemark::Trend::Positive, "+5%"))
43 .add_group(
44 FindingGroup::new("Accessibility Violations")
45 .add_finding(
46 Finding::new(runemark::Tone::Warning, "Image missing alt attribute")
47 .with_rule_id("a11y/img-alt")
48 .with_badge(runemark::Badge::quick_win())
49 .with_confidence(runemark::Confidence::High)
50 .with_location(Location::file_line_col("src/pages/index.astro", 42, 10))
51 .with_remedy("Add alt=\"...\" description to <img> tag"),
52 )
53 .add_finding(
54 Finding::new(runemark::Tone::Warning, "Low contrast ratio on hero button")
55 .with_rule_id("a11y/contrast")
56 .with_location(Location::file_line("src/components/Hero.astro", 18)),
57 ),
58 )
59 .add_next_step(
60 NextStep::new("Run auto-fixer for formatting issues").with_command("audit --fix"),
61 );
62
63 print!("{}", report.render(console));
64
65 println!("=== 4. Detailed Report View ===");
66 let detailed_report = report.with_detail_level(DetailLevel::Detailed);
67 print!("{}", detailed_report.render(console));
68
69 println!("=== 5. Generator Diff View ===");
70 let diff = DiffBlock::new()
71 .add_change(
72 FileChange::new(FileAction::Added, "src/components/Footer.astro").with_delta("+1.2 kB"),
73 )
74 .add_change(FileChange::new(
75 FileAction::Modified,
76 "src/layouts/Layout.astro",
77 ))
78 .add_change(FileChange::new(
79 FileAction::Deleted,
80 "src/legacy/Footer.jsx",
81 ));
82 print!("{}", diff.render(console));
83}Sourcepub fn with_command(self, command: impl Into<String>) -> Self
pub fn with_command(self, command: impl Into<String>) -> Self
Attaches a copyable command.
Examples found in repository?
examples/report_demo.rs (line 60)
6fn main() {
7 let console = Console::stdout(ColorMode::Auto);
8
9 println!("=== 1. Verdict & Status ===");
10 println!(
11 "{}",
12 Verdict::Passed.render(console, "Configuration validated cleanly")
13 );
14 println!(
15 "{}",
16 Verdict::Warning.render(console, "3 non-critical findings detected")
17 );
18 println!(
19 "{}",
20 Verdict::Failed.render(console, "Build failed: 2 errors")
21 );
22 println!();
23
24 println!("=== 2. Error / Prerequisite Block ===");
25 let err_block = ErrorBlock::new("Required toolchain is unavailable")
26 .with_explanation("The configured version is not installed.")
27 .with_remedy("Install the required toolchain:")
28 .add_command("toolchain install stable");
29 print!("{}", err_block.render(console));
30
31 println!("=== 3. Decision-Oriented Report (Compact) ===");
32 let report = Report::new("Site audit v1.2.0", Verdict::Warning)
33 .add_scope_note(ScopeNote::new(
34 "Scope warnings",
35 vec![
36 "Git history partial".to_string(),
37 "1 file skipped".to_string(),
38 ],
39 ))
40 .add_metric(Metric::new("Errors", "0"))
41 .add_metric(Metric::new("Warnings", "4").with_trend(runemark::Trend::Negative, "+2"))
42 .add_metric(Metric::new("Score", "94/100").with_trend(runemark::Trend::Positive, "+5%"))
43 .add_group(
44 FindingGroup::new("Accessibility Violations")
45 .add_finding(
46 Finding::new(runemark::Tone::Warning, "Image missing alt attribute")
47 .with_rule_id("a11y/img-alt")
48 .with_badge(runemark::Badge::quick_win())
49 .with_confidence(runemark::Confidence::High)
50 .with_location(Location::file_line_col("src/pages/index.astro", 42, 10))
51 .with_remedy("Add alt=\"...\" description to <img> tag"),
52 )
53 .add_finding(
54 Finding::new(runemark::Tone::Warning, "Low contrast ratio on hero button")
55 .with_rule_id("a11y/contrast")
56 .with_location(Location::file_line("src/components/Hero.astro", 18)),
57 ),
58 )
59 .add_next_step(
60 NextStep::new("Run auto-fixer for formatting issues").with_command("audit --fix"),
61 );
62
63 print!("{}", report.render(console));
64
65 println!("=== 4. Detailed Report View ===");
66 let detailed_report = report.with_detail_level(DetailLevel::Detailed);
67 print!("{}", detailed_report.render(console));
68
69 println!("=== 5. Generator Diff View ===");
70 let diff = DiffBlock::new()
71 .add_change(
72 FileChange::new(FileAction::Added, "src/components/Footer.astro").with_delta("+1.2 kB"),
73 )
74 .add_change(FileChange::new(
75 FileAction::Modified,
76 "src/layouts/Layout.astro",
77 ))
78 .add_change(FileChange::new(
79 FileAction::Deleted,
80 "src/legacy/Footer.jsx",
81 ));
82 print!("{}", diff.render(console));
83}Trait Implementations§
impl Eq for NextStep
impl StructuralPartialEq for NextStep
Auto Trait Implementations§
impl Freeze for NextStep
impl RefUnwindSafe for NextStep
impl Send for NextStep
impl Sync for NextStep
impl Unpin for NextStep
impl UnsafeUnpin for NextStep
impl UnwindSafe for NextStep
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more