Skip to main content

ConsoleBuilder

Struct ConsoleBuilder 

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

Builder for constructing a Console with custom options.

Implementations§

Source§

impl ConsoleBuilder

Source

pub fn new() -> Self

Create a new builder with default settings.

Source

pub fn color_system(self, cs: &str) -> Self

Set the color system by name ("standard", "256", "truecolor", "windows").

Source

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

Set the console width in columns.

Source

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

Set the console height in rows.

Source

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

Force or prevent terminal detection regardless of the actual environment.

Source

pub fn record(self, r: bool) -> Self

Enable or disable recording of output for later export.

Source

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

Set a custom theme for style lookups.

Source

pub fn markup(self, m: bool) -> Self

Enable or disable markup parsing in print methods.

Source

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

Enable or disable automatic syntax highlighting.

Source

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

Enable or disable all color output.

Source

pub fn color_system_override(self, cs: ColorSystem) -> Self

Explicitly override the color system, taking priority over both environment variables and the string-based color_system method.

Source

pub fn tab_size(self, ts: usize) -> Self

Set the tab size in spaces for text rendering.

Source

pub fn quiet(self, q: bool) -> Self

Enable or disable quiet mode, which suppresses all output.

Source

pub fn soft_wrap(self, sw: bool) -> Self

Enable or disable soft wrapping (allows lines to exceed terminal width).

Source

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

Enable or disable safe box characters (ASCII fallback for non-UTF-8 terminals).

Source

pub fn build(self) -> Console

Build the Console instance with the configured options.

§Examples
use gilt::console::Console;

let console = Console::builder()
    .width(80)
    .no_color(true)
    .build();
assert_eq!(console.width(), 80);

Build the Console instance with the configured options.

Trait Implementations§

Source§

impl Default for ConsoleBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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