Skip to main content

TerminalFrontend

Struct TerminalFrontend 

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

A standard terminal frontend that uses ANSI escape sequences.

This frontend renders output in-place by issuing cursor-up ANSI commands (\x1b[{n}A) and clearing the current line (\x1b[2K\r).

Implementations§

Source§

impl<W: Write> TerminalFrontend<W>

Source

pub const fn new(writer: W) -> Self

Creates a new TerminalFrontend wrapping the given stream.

§Default Configuration
  • Bar Width: 40 characters.
  • Theme: Modern UTF-8 defaults.
  • Byte Formatting: Disabled.
§Parameters
  • writer: The I/O stream to render to.
Source

pub const fn with_theme(self, theme: Theme) -> Self

Customizes the visual theme.

Source

pub const fn with_width(self, width: usize) -> Self

Sets the width of the progress bar (in characters).

Source

pub const fn with_byte_formatting(self, formatter: ByteFormatter) -> Self

Enables automatic byte formatting for position, total, and throughput using the provided prettier_bytes::ByteFormatter rules.

Trait Implementations§

Source§

impl<W: Write> Frontend for TerminalFrontend<W>

Source§

fn render(&mut self, snapshot: &ProgressSnapshot) -> Result<()>

Renders a single progress snapshot.
Source§

fn render_stack(&mut self, stack: &ProgressStackSnapshot) -> Result<()>

Renders a snapshot of a progress stack (multiple trackers).
Source§

fn clear(&mut self) -> Result<()>

Clears the rendered progress indicators from the screen.
Source§

fn finish(&mut self) -> Result<()>

Signals that progress tracking is finished, allowing the frontend to clean up or flush its output.

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

§

impl<W> UnwindSafe for TerminalFrontend<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.