Struct prodash::render::line::Options[][src]

pub struct Options {
    pub output_is_terminal: bool,
    pub colored: bool,
    pub timestamp: bool,
    pub terminal_dimensions: (u16, u16),
    pub hide_cursor: bool,
    pub throughput: bool,
    pub level_filter: Option<RangeInclusive<Level>>,
    pub initial_delay: Option<Duration>,
    pub frames_per_second: f32,
    pub keep_running_if_progress_is_empty: bool,
}
Expand description

Options used for configuring a line renderer.

Fields

output_is_terminal: bool

If true, (default true), we assume the output stream belongs to a terminal.

If false, we won’t print any live progress, only log messages.

colored: bool

If true, (default: true) we will display color. You should use output_is_terminal && crosstermion::should_colorize() to determine this value.

Please note that you can enforce color even if the output stream is not connected to a terminal by setting this field to true.

timestamp: bool

If true, (default: false), a timestamp will be shown before each message.

terminal_dimensions: (u16, u16)

The amount of columns and rows to use for drawing. Defaults to (80, 20).

hide_cursor: bool

If true, (default: false), the cursor will be hidden for a more visually appealing display.

Please note that you must make sure the line renderer is properly shut down to restore the previous cursor settings. See the signal-hook documentation in the README for more information.

throughput: bool

If true, (default false), we will keep track of the previous progress state to derive continuous throughput information from. Throughput will only show for units which have explicitly enabled it, it is opt-in.

This comes at the cost of additional memory and CPU time.

level_filter: Option<RangeInclusive<Level>>

If set, specify all levels that should be shown. Otherwise all available levels are shown.

This is useful to filter out high-noise lower level progress items in the tree.

initial_delay: Option<Duration>

If set, progress will only actually be shown after the given duration. Log messages will always be shown without delay.

This option can be useful to not enforce progress for short actions, causing it to flicker. Please note that this won’t affect display of messages, which are simply logged.

frames_per_second: f32

The amount of frames to draw per second. If below 1.0, it determines the amount of seconds between the frame.

e.g. 1.0/4.0 is one frame every 4 seconds.

keep_running_if_progress_is_empty: bool

If true (default: true), we will keep waiting for progress even after we encountered an empty list of drawable progress items.

Please note that you should add at least one item to the prodash::Tree before launching the application or else risk a race causing nothing to be rendered at all.

Implementations

Convenience

Automatically configure (and overwrite) the following fields based on terminal configuration.

  • output_is_terminal
  • colored
  • terminal_dimensions
  • hide-cursor (based on presence of ‘signal-hook’ feature.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.