pub struct SectionGuard<'p> { /* private fields */ }Expand description
Open section. Holds a reference to Printer and the renderer’s depth.
Drop closes the section: emits a deferred (none) placeholder if no
children rendered (and keep_when_empty was true), or leaves no trace
(if keep_when_empty was false).
Implementations§
Source§impl<'p> SectionGuard<'p>
impl<'p> SectionGuard<'p>
pub fn bullet(&self, text: impl Into<String>) -> &Self
pub fn kv(&self, key: impl Into<String>, value: impl Into<String>) -> &Self
pub fn kv_block<I, K, V>(&self, pairs: I) -> &Self
pub fn hint(&self, text: impl Into<String>) -> &Self
pub fn note(&self, text: impl Into<String>) -> &Self
pub fn table(&self, table: Table) -> &Self
Sourcepub fn empty_state(&self, text: impl Into<String>) -> &Self
pub fn empty_state(&self, text: impl Into<String>) -> &Self
Set the empty-state placeholder for this section (overrides the default
“(none)”). Only meaningful for sections opened with section() (not
section_or_collapse()).
Sourcepub fn status_simple(&self, role: Role, subject: impl Into<String>) -> &Self
pub fn status_simple(&self, role: Role, subject: impl Into<String>) -> &Self
Status with no extra fields. For chained detail/duration/target, use
status for the chainable builder.
Sourcepub fn status(
&self,
role: Role,
subject: impl Into<String>,
) -> StatusBuilder<'_>
pub fn status( &self, role: Role, subject: impl Into<String>, ) -> StatusBuilder<'_>
Status builder at this section’s depth. Commits on Drop.
Sourcepub fn section(&self, name: impl Into<String>) -> SectionGuard<'_>
pub fn section(&self, name: impl Into<String>) -> SectionGuard<'_>
Open a child section. Returns a guard that borrows &self so the parent
is locked until the child drops.
pub fn section_or_collapse(&self, name: impl Into<String>) -> SectionGuard<'_>
Sourcepub fn spinner(&self, message: impl Into<String>) -> Spinner<'_>
pub fn spinner(&self, message: impl Into<String>) -> Spinner<'_>
Section-scoped spinner. Inherits the section’s depth so the eventual
Status emitted by finish_* lands at the right indentation.
Sourcepub fn progress_bar(
&self,
total: u64,
message: impl Into<String>,
) -> ProgressBar<'_>
pub fn progress_bar( &self, total: u64, message: impl Into<String>, ) -> ProgressBar<'_>
Section-scoped progress bar.
Sourcepub fn run(
&self,
cmd: &mut Command,
label: impl Into<String>,
) -> Result<CommandOutput>
pub fn run( &self, cmd: &mut Command, label: impl Into<String>, ) -> Result<CommandOutput>
Run an external command at this section’s depth with live output. TTY+non-quiet → spinner with tailing ring indented under the section; otherwise → streaming lines. Either path captures full stdout/stderr.