Skip to main content

ConsoleBuilder

Struct ConsoleBuilder 

Source
pub struct ConsoleBuilder { /* private fields */ }
Expand description

Builder for Console, allowing detection to be overridden.

Implementations§

Source§

impl ConsoleBuilder

Source

pub fn force_terminal(self, value: bool) -> Self

Source

pub fn legacy_windows(self, value: bool) -> Self

Force legacy-Windows-console behavior (box substitution). Default off.

Source

pub fn safe_box(self, value: bool) -> Self

Enable/disable terminal-safe box substitution (default on).

Source

pub fn ascii_only(self, value: bool) -> Self

Force ASCII-only box rendering (default off). Set for non-UTF-8 terminals.

Source

pub fn color_system(self, system: Option<ColorSystem>) -> Self

Force a specific color system (use for reproducible output/tests).

Source

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

Source

pub fn height(self, height: usize) -> Self

Set the console height in rows (used by Layout).

Source

pub fn no_color(self, value: bool) -> Self

Enable no-colour mode: colours are stripped from output while other attributes (bold, underline, …) still render. Unset, a non-empty NO_COLOR environment variable enables it. Port of no_color=.

Source

pub fn get_time(self, clock: impl Fn() -> f64 + Send + Sync + 'static) -> Self

Read the current time (seconds) from clock instead of the monotonic clock. Port of Console(get_time=…); animations such as Spinner render the frame for this time.

Source

pub fn emoji(self, value: bool) -> Self

Enable/disable :emoji: shortcode replacement (default enabled).

Source

pub fn highlight(self, value: bool) -> Self

Enable/disable automatic repr highlighting. Defaults to on, matching upstream Console(highlight=True).

Source

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

Source

pub fn build(self) -> Console

Auto Trait Implementations§

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.