pub struct RenderOptions { /* private fields */ }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
impl RenderOptions
Sourcepub const fn new(color: ColorMode) -> Self
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.
Sourcepub const fn color(self, color: ColorMode) -> Self
pub const fn color(self, color: ColorMode) -> Self
Write colour as color says, in place of the mode given to
Self::new.
Sourcepub const fn theme(self, theme: Theme) -> Self
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.
Sourcepub const fn record_style(self, style: RecordStyle) -> Self
pub const fn record_style(self, style: RecordStyle) -> Self
Frame Fields records in style. This beats the environment.
Sourcepub const fn frame(self, frame: Frame) -> Self
pub const fn frame(self, frame: Frame) -> Self
Set the frame every Table draws to frame. This beats the
environment.
Sourcepub const fn row_separation(self, separation: RowSeparation) -> Self
pub const fn row_separation(self, separation: RowSeparation) -> Self
Separate Table rows with separation. This beats the environment.
Sourcepub const fn record_style_envs(self, names: &'static [&'static str]) -> Self
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.
Sourcepub const fn frame_envs(self, names: &'static [&'static str]) -> Self
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.
Sourcepub const fn row_separation_envs(self, names: &'static [&'static str]) -> Self
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.
Sourcepub const fn width(self, width: u16) -> Self
pub const fn width(self, width: u16) -> Self
Force an explicit width. Use it in tests and wherever no terminal decides the width.
Sourcepub const fn automatic_width_buffer(self, cells: u16) -> Self
Available on crate features help or view only.
pub const fn automatic_width_buffer(self, cells: u16) -> Self
help or view only.Override the automatic-width buffer. Zero explicitly disables it.
Explicit Self::width remains exact regardless of this value.
Sourcepub const fn automatic_width_buffer_envs(
self,
names: &'static [&'static str],
) -> Self
Available on crate features help or view only.
pub const fn automatic_width_buffer_envs( self, names: &'static [&'static str], ) -> Self
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.
Sourcepub const fn minimum_automatic_width(self, cells: u16) -> Self
Available on crate features help or view only.
pub const fn minimum_automatic_width(self, cells: u16) -> Self
help or view only.Set the floor for automatically detected effective widths.
Sourcepub const fn fallback_width(self, width: Option<u16>) -> Self
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.
Sourcepub fn resolved_record_style(self) -> RecordStyle
pub fn resolved_record_style(self) -> RecordStyle
Record framing: the CLI’s choice, then the environment, then the default. It reads the process environment.
Sourcepub fn resolved_frame(self) -> Frame
pub fn resolved_frame(self) -> Frame
Table frame: the CLI’s choice, then the environment, then the default. It reads the process environment.
Sourcepub fn resolved_row_separation(self) -> RowSeparation
pub fn resolved_row_separation(self) -> RowSeparation
Row separation: the CLI’s choice, then the environment, then the default. It reads the process environment.