Skip to main content

RenderOptions

Struct RenderOptions 

Source
pub struct RenderOptions { /* private fields */ }
Available on crate feature render only.
Expand description

How a document renders: colour mode, width, theme, and styles.

A setter takes the name of its setting and returns the options changed. The options have no getters, which would need the same names. A method that reads the environment starts with resolved_.

Implementations§

Source§

impl RenderOptions

Source

pub const fn new(color: ColorMode) -> Self

Build options with DEFAULT_FALLBACK_WIDTH when no width is detected. Record style, table frame, and row separation read DEFAULT_RECORD_STYLE_ENV, DEFAULT_LIST_STYLE_ENV, and DEFAULT_ROW_SEPARATION_ENV unless the CLI sets them. Roles are drawn in Theme::default.

With view or help, the width is detected for the stream written, with a buffer of DEFAULT_COLUMN_BUFFER cells and DEFAULT_COLUMN_BUFFER_ENV as the user’s override.

Source

pub const fn color(self, color: ColorMode) -> Self

Write colour as color says, in place of the mode given to Self::new.

Source

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

Draw each Role in the style theme gives it, in place of Theme::default. Colour is still the colour mode’s choice: ColorMode::Never writes no style.

Source

pub const fn record_style(self, style: RecordStyle) -> Self

Frame Fields records in style. This beats the environment.

Source

pub const fn frame(self, frame: Frame) -> Self

Set the frame every Table draws to frame. This beats the environment.

Source

pub const fn row_separation(self, separation: RowSeparation) -> Self

Separate Table rows with separation. This beats the environment.

Source

pub const fn record_style_envs(self, names: &'static [&'static str]) -> Self

Replace the ordered environment names read for the record style. An empty slice disables lookup.

Source

pub const fn frame_envs(self, names: &'static [&'static str]) -> Self

Replace the ordered environment names read for the table frame. An empty slice disables lookup.

Source

pub const fn row_separation_envs(self, names: &'static [&'static str]) -> Self

Replace the ordered environment names read for the row separation. An empty slice disables lookup.

Source

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

Force an explicit width. Use it in tests and wherever no terminal decides the width.

Source

pub const fn automatic_width_buffer(self, cells: u16) -> Self

Available on crate features help or view only.

Override the automatic-width buffer. Zero explicitly disables it. Explicit Self::width remains exact regardless of this value.

Source

pub const fn automatic_width_buffer_envs( self, names: &'static [&'static str], ) -> Self

Available on crate features help or view only.

Replace the ordered environment names that set the buffer. Pass aliases in precedence order or an empty slice to disable lookup.

Source

pub const fn minimum_automatic_width(self, cells: u16) -> Self

Available on crate features help or view only.

Set the floor for automatically detected effective widths.

Source

pub const fn fallback_width(self, width: Option<u16>) -> Self

Lay out to width when neither the terminal nor COLUMNS gives one. None renders tables at their natural width instead. This does not touch the minimum automatic width, which applies only to a detected width.

Source

pub fn resolved_record_style(self) -> RecordStyle

Record framing: the CLI’s choice, then the environment, then the default. It reads the process environment.

Source

pub fn resolved_frame(self) -> Frame

Table frame: the CLI’s choice, then the environment, then the default. It reads the process environment.

Source

pub fn resolved_row_separation(self) -> RowSeparation

Row separation: the CLI’s choice, then the environment, then the default. It reads the process environment.

Trait Implementations§

Source§

impl Clone for RenderOptions

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 Copy for RenderOptions

Source§

impl Debug for RenderOptions

Source§

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

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

impl Eq for RenderOptions

Source§

impl PartialEq for RenderOptions

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RenderOptions

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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, O> Matches<O> for T
where T: PartialEq<O>,

Source§

fn validate_matches(&self, other: &O) -> bool

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.