Skip to main content

StatusReporter

Struct StatusReporter 

Source
pub struct StatusReporter<W> { /* private fields */ }
Expand description

A status-line reporter over an injected writer, palette, and glyph set.

Implementations§

Source§

impl StatusReporter<Stderr>

Source

pub fn from_env(color: ColorChoice) -> Self

Build a reporter bound to process stderr.

The Palette resolves from color against stderr and the Glyphs from the process locale, so color and symbols both honour redirection, NO_COLOR, and terminal encoding.

Source§

impl<W: Write> StatusReporter<W>

Source

pub const fn new(writer: W, palette: Palette, glyphs: Glyphs) -> Self

Build a reporter from explicit parts.

Source

pub fn success(&mut self, message: &str) -> AppResult<()>

Emit a success line: a green check glyph followed by message.

§Errors

Returns an error when the underlying writer fails.

Source

pub fn error(&mut self, message: &str) -> AppResult<()>

Emit an error line: a red cross glyph followed by message.

§Errors

Returns an error when the underlying writer fails.

Source

pub fn warn(&mut self, message: &str) -> AppResult<()>

Emit a warning line: a yellow warning glyph followed by message.

§Errors

Returns an error when the underlying writer fails.

Source

pub fn info(&mut self, message: &str) -> AppResult<()>

Emit an informational line: a cyan info glyph followed by message.

§Errors

Returns an error when the underlying writer fails.

Source

pub fn bullet(&mut self, message: &str) -> AppResult<()>

Emit an indented bullet line: a dimmed bullet glyph followed by message.

§Errors

Returns an error when the underlying writer fails.

Source

pub fn step( &mut self, current: usize, total: usize, message: &str, ) -> AppResult<()>

Emit a step line prefixed with a dimmed [current/total] counter.

§Errors

Returns an error when the underlying writer fails.

Source

pub fn heading(&mut self, title: &str) -> AppResult<()>

Emit a bold section heading preceded by a blank line.

§Errors

Returns an error when the underlying writer fails.

Auto Trait Implementations§

§

impl<W> Freeze for StatusReporter<W>
where W: Freeze,

§

impl<W> RefUnwindSafe for StatusReporter<W>
where W: RefUnwindSafe,

§

impl<W> Send for StatusReporter<W>
where W: Send,

§

impl<W> Sync for StatusReporter<W>
where W: Sync,

§

impl<W> Unpin for StatusReporter<W>
where W: Unpin,

§

impl<W> UnsafeUnpin for StatusReporter<W>
where W: UnsafeUnpin,

§

impl<W> UnwindSafe for StatusReporter<W>
where W: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.