pub struct ConsoleOptions {Show 21 fields
pub size: (usize, usize),
pub min_width: usize,
pub max_width: usize,
pub max_height: usize,
pub height: Option<usize>,
pub is_terminal: bool,
pub encoding: String,
pub legacy_windows: bool,
pub justify: Option<JustifyMethod>,
pub overflow: Option<OverflowMethod>,
pub no_wrap: bool,
pub highlight: Option<bool>,
pub markup: Option<bool>,
pub theme_stack: ThemeStack,
pub theme_name: String,
pub markup_enabled: bool,
pub emoji_enabled: bool,
pub highlight_enabled: bool,
pub tab_size: usize,
pub disable_line_wrap: bool,
pub color_system: Option<ColorSystem>,
}Expand description
Options passed through the rendering pipeline.
This struct carries rendering context that flows through the entire render pipeline, allowing renderables to adapt to the output context.
§Console State
In addition to rendering options, this struct carries console configuration that renderables may need to access (theme styles, feature flags, etc.). This allows nested renderables to access console configuration without needing a direct reference to the Console.
Fields§
§size: (usize, usize)Terminal dimensions as (width, height).
min_width: usizeMinimum width for rendering.
max_width: usizeMaximum width for rendering.
max_height: usizeMaximum height constraint.
height: Option<usize>Optional height constraint for specific renderables.
is_terminal: boolWhether output is to a terminal (vs file/pipe).
encoding: StringCharacter encoding.
legacy_windows: boolWhether to use legacy Windows console.
justify: Option<JustifyMethod>Text justification override.
overflow: Option<OverflowMethod>Text overflow handling override.
no_wrap: boolDisable text wrapping.
highlight: Option<bool>Highlight override for render_str.
markup: Option<bool>Markup parsing enabled.
theme_stack: ThemeStackTheme stack for style lookups. Cloned from the console.
theme_name: StringCurrent theme name (e.g., “default”, “dracula”). Renderables can use this to match their theme to the console.
markup_enabled: boolWhether markup parsing is enabled by default.
emoji_enabled: boolWhether emoji replacement is enabled by default.
highlight_enabled: boolWhether highlighting is enabled by default.
tab_size: usizeTab size for tab expansion.
disable_line_wrap: boolDisable terminal automatic line wrap while printing.
This prevents “soft wrap” artifacts when output fills exactly the last column of the terminal (common on Windows Terminal and xterm-like VTs).
When enabled and writing to a real terminal, the Console will emit
ESC[?7l before printing and ESC[?7h after.
color_system: Option<ColorSystem>Detected color system (None = no colors).
Implementations§
Source§impl ConsoleOptions
impl ConsoleOptions
Sourcepub fn from_terminal() -> Self
pub fn from_terminal() -> Self
Create options from the current terminal.
Sourcepub fn ascii_only(&self) -> bool
pub fn ascii_only(&self) -> bool
Check if renderables should use ASCII only.
Sourcepub fn update(
&self,
width: Option<usize>,
min_width: Option<usize>,
max_width: Option<usize>,
justify: Option<Option<JustifyMethod>>,
overflow: Option<Option<OverflowMethod>>,
no_wrap: Option<bool>,
highlight: Option<Option<bool>>,
markup: Option<Option<bool>>,
height: Option<Option<usize>>,
) -> Self
pub fn update( &self, width: Option<usize>, min_width: Option<usize>, max_width: Option<usize>, justify: Option<Option<JustifyMethod>>, overflow: Option<Option<OverflowMethod>>, no_wrap: Option<bool>, highlight: Option<Option<bool>>, markup: Option<Option<bool>>, height: Option<Option<usize>>, ) -> Self
Update values and return a new copy.
Only non-None values in the update parameters will override the existing values.
Sourcepub fn update_width(&self, width: usize) -> Self
pub fn update_width(&self, width: usize) -> Self
Update just the width, return a copy.
Sourcepub fn update_height(&self, height: usize) -> Self
pub fn update_height(&self, height: usize) -> Self
Update the height and return a copy.
Sourcepub fn update_dimensions(&self, width: usize, height: usize) -> Self
pub fn update_dimensions(&self, width: usize, height: usize) -> Self
Update both width and height, return a copy.
Sourcepub fn reset_height(&self) -> Self
pub fn reset_height(&self) -> Self
Reset height to None, return a copy.
Trait Implementations§
Source§impl Clone for ConsoleOptions
impl Clone for ConsoleOptions
Source§fn clone(&self) -> ConsoleOptions
fn clone(&self) -> ConsoleOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more