pub struct Pretty { /* private fields */ }Expand description
A renderable that pretty prints a value. Mirrors rich.pretty.Pretty.
Implementations§
Source§impl Pretty
impl Pretty
Sourcepub fn new(value: &impl Debug) -> Self
pub fn new(value: &impl Debug) -> Self
Pretty-print value ({:#?}, multi-line and indented) and highlight
it. Not upstream’s layout; see Pretty::from_value.
Sourcepub fn compact(value: &impl Debug) -> Self
pub fn compact(value: &impl Debug) -> Self
Format value compactly on one line ({:?}) and highlight it.
Sourcepub fn from_value(value: PrettyValue) -> Self
pub fn from_value(value: PrettyValue) -> Self
Pretty-print a Python value as upstream’s Pretty(obj) does.
Sourcepub fn highlighter(
self,
highlighter: impl Highlighter + Send + Sync + 'static,
) -> Self
pub fn highlighter( self, highlighter: impl Highlighter + Send + Sync + 'static, ) -> Self
The highlighter applied to the repr (upstream highlighter, default
ReprHighlighter).
Sourcepub fn indent_size(self, indent_size: usize) -> Self
pub fn indent_size(self, indent_size: usize) -> Self
Spaces per indent level (upstream indent_size, default 4).
Sourcepub fn justify(self, justify: Option<Justify>) -> Self
pub fn justify(self, justify: Option<Justify>) -> Self
Justify method, or None for the console’s (upstream justify).
Sourcepub fn overflow(self, overflow: Option<Overflow>) -> Self
pub fn overflow(self, overflow: Option<Overflow>) -> Self
Overflow method, or None for the console’s (upstream overflow).
Sourcepub fn no_wrap(self, no_wrap: Option<bool>) -> Self
pub fn no_wrap(self, no_wrap: Option<bool>) -> Self
Disable wrapping, or None for the console’s (upstream no_wrap,
default False).
Sourcepub fn indent_guides(self, indent_guides: bool) -> Self
pub fn indent_guides(self, indent_guides: bool) -> Self
Draw indent guides (upstream indent_guides).
Sourcepub fn max_length(self, max_length: Option<usize>) -> Self
pub fn max_length(self, max_length: Option<usize>) -> Self
Abbreviate containers longer than this (upstream max_length).
Sourcepub fn max_string(self, max_string: Option<usize>) -> Self
pub fn max_string(self, max_string: Option<usize>) -> Self
Truncate strings longer than this (upstream max_string).
Sourcepub fn max_depth(self, max_depth: Option<usize>) -> Self
pub fn max_depth(self, max_depth: Option<usize>) -> Self
Stop at this depth of nesting (upstream max_depth).
Sourcepub fn expand_all(self, expand_all: bool) -> Self
pub fn expand_all(self, expand_all: bool) -> Self
Expand every container (upstream expand_all).
Sourcepub fn margin(self, margin: usize) -> Self
pub fn margin(self, margin: usize) -> Self
Cells taken off the width, so containers expand sooner (upstream
margin).
Sourcepub fn insert_line(self, insert_line: bool) -> Self
pub fn insert_line(self, insert_line: bool) -> Self
Start with a blank line when the output has several lines (upstream
insert_line).
Trait Implementations§
Source§impl Renderable for Pretty
impl Renderable for Pretty
fn rich_render( &self, console: &Console, options: &ConsoleOptions, ) -> Vec<Segment>
Source§fn measure(&self, console: &Console, options: &ConsoleOptions) -> Measurement
fn measure(&self, console: &Console, options: &ConsoleOptions) -> Measurement
(minimum, maximum) cell width this renderable wants. Port of
__rich_measure__. The default is what upstream’s Measurement.get
returns for a renderable without one: anything from nothing to the
whole width, (0, max_width).Source§fn fit_to_measurement(&self) -> bool
fn fit_to_measurement(&self) -> bool
Console::print shrinks this renderable to its
measured width. Upstream renders every top-level renderable at the full
console width, so the default is false; an extension may opt in.Source§fn vertical(&self) -> Option<VerticalAlign>
fn vertical(&self) -> Option<VerticalAlign>
Table cell holding this renderable uses in
place of its column’s. Upstream reads getattr(renderable, "vertical", None); Align sets it.Source§fn print_end_line(&self, _options: &ConsoleOptions) -> bool
fn print_end_line(&self, _options: &ConsoleOptions) -> bool
"\n", so a print adds the final line break. A renderable
whose upstream output stops without one (Screen, LiveRender, a
Rule whose end has no newline) returns false, and the next
output continues its last line. options are the print’s options.