Skip to main content

ConsoleOptions

Struct ConsoleOptions 

Source
pub struct ConsoleOptions {
Show 13 fields pub min_width: usize, pub max_width: usize, pub height: Option<usize>, pub justify: Justify, pub overflow: Option<Overflow>, pub no_wrap: Option<bool>, pub highlight: Option<bool>, pub markup: Option<bool>, pub max_height: usize, pub encoding: String, pub is_terminal: bool, pub legacy_windows: bool, pub size: ConsoleDimensions,
}
Expand description

The options passed to a Renderable describing the space it must fit into.

Port of the core of rich.console.ConsoleOptions. Only the fields needed by the currently-ported renderables are present; more are added as widgets land.

Fields§

§min_width: usize§max_width: usize§height: Option<usize>§justify: Justify§overflow: Option<Overflow>

Overflow method to impose on renderables, or None to let each pick its own. Mirrors ConsoleOptions.overflow.

§no_wrap: Option<bool>

Disable wrapping, or None to let each renderable pick. Mirrors ConsoleOptions.no_wrap.

§highlight: Option<bool>

Highlight override for strings rendered under these options, or None for the console default. Mirrors ConsoleOptions.highlight: Panel, Table and Tree set it for their children, and upstream’s Console.render passes it to render_str for a str renderable.

§markup: Option<bool>

Markup override for strings rendered under these options, or None for the console default. Mirrors ConsoleOptions.markup.

§max_height: usize

Height of the container (starts as the terminal height). Mirrors ConsoleOptions.max_height.

§encoding: String

Encoding of the terminal ("utf-8", or "ascii" for an ASCII-only console). Mirrors ConsoleOptions.encoding.

§is_terminal: bool

Whether the target is a terminal. Mirrors ConsoleOptions.is_terminal.

§legacy_windows: bool

Whether the target is a legacy Windows console. Mirrors ConsoleOptions.legacy_windows.

§size: ConsoleDimensions

The size of the console. Mirrors ConsoleOptions.size.

Implementations§

Source§

impl ConsoleOptions

Source

pub fn update_width(&self, width: usize) -> ConsoleOptions

Return a copy with max_width (and a clamped min_width) updated. Port of ConsoleOptions.update_width.

Source

pub fn update_dimensions(&self, width: usize, height: usize) -> ConsoleOptions

Return a copy with both width and height pinned. Port of ConsoleOptions.update_dimensions.

Source

pub fn update_height(&self, height: usize) -> ConsoleOptions

Return a copy with the height (and max_height) set. Port of ConsoleOptions.update_height.

Source

pub fn reset_height(&self) -> ConsoleOptions

Return a copy with height cleared. Port of ConsoleOptions.reset_height.

Source

pub fn ascii_only(&self) -> bool

Whether renderables should use ASCII only: the encoding is not a UTF one. Port of the ConsoleOptions.ascii_only property.

Trait Implementations§

Source§

impl Clone for ConsoleOptions

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConsoleOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ConsoleOptions

Source§

fn default() -> Self

The options of a default 80x25 UTF-8 console, as Console::options builds them.

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.