pub struct RenderConfig<'a> {Show 20 fields
pub prompt_prefix: Styled<&'a str>,
pub answered_prompt_prefix: Styled<&'a str>,
pub prompt: StyleSheet,
pub default_value: StyleSheet,
pub placeholder: StyleSheet,
pub help_message: StyleSheet,
pub password_mask: char,
pub text_input: StyleSheet,
pub answer: StyleSheet,
pub canceled_prompt_indicator: Styled<&'a str>,
pub error_message: ErrorMessageRenderConfig<'a>,
pub highlighted_option_prefix: Styled<&'a str>,
pub scroll_up_prefix: Styled<&'a str>,
pub scroll_down_prefix: Styled<&'a str>,
pub selected_checkbox: Styled<&'a str>,
pub unselected_checkbox: Styled<&'a str>,
pub option_index_prefix: IndexPrefix,
pub option: StyleSheet,
pub selected_option: Option<StyleSheet>,
pub editor_prompt: StyleSheet,
}Expand description
Rendering configuration that can be applied to a prompt.
Render configurations can set mostly style sheets for particular parts of the prompt layout. Additionally, it allows you to set the content of a few tokens, such as prompt or error message prefixes.
§Example
use inquire::ui::{Color, RenderConfig, Styled};
let empty: RenderConfig = RenderConfig::empty();
let default: RenderConfig = RenderConfig::default();
let prompt_prefix = Styled::new("$").with_fg(Color::DarkRed);
let mine = default.with_prompt_prefix(prompt_prefix);Fields§
§prompt_prefix: Styled<&'a str>Prefix added before prompts.
Note: a space character will be added to separate the prefix and the prompt message.
answered_prompt_prefix: Styled<&'a str>Prefix added before answered prompts.
Note: a space character will be added to separate the prefix and the prompt message.
prompt: StyleSheetStyle of the prompt message, applicable to all prompt types.
default_value: StyleSheetRender configuration of default values.
Note: default values are displayed wrapped in parenthesis, e.g. (yes). Non-styled space characters is added before the default value display and after the default value, as separators.
placeholder: StyleSheetRender configuration of placeholders.
Note: placeholders are displayed wrapped in parenthesis, e.g. (yes). Non-styled space characters is added before the default value display and after the default value, as separators.
help_message: StyleSheetRender configuration of help messages.
Note: help messages are displayed wrapped in brackets, e.g. [Be careful!].
password_mask: charCharacter used to mask password text inputs when in mode
Masked.
Note: Styles for masked text inputs are set in the
text_input configuration.
text_input: StyleSheetStyle sheet for text inputs.
Note: a non-styled space character is added before the text input as a separator from the prompt message (or default value display).
answer: StyleSheetRender configuration of final prompt answers (submissions).
Note: a non-styled space character is added before the answer as a separator from the prompt message (or default value display).
canceled_prompt_indicator: Styled<&'a str>Render configuration of the message printed in the place of an answer when the prompt is canceled by the user - by pressing ESC.
Note: a non-styled space character is added before the indicator as a separator from the prompt message.
error_message: ErrorMessageRenderConfig<'a>Render configuration for error messages.
highlighted_option_prefix: Styled<&'a str>Prefix for the current highlighted option.
Note: a space character will be added to separate the prefix and the option value or the checkbox.
scroll_up_prefix: Styled<&'a str>Prefix for the option listed at the top of the page, when it is possible to scroll up.
Note: a space character will be added to separate the prefix and the option value or the checkbox.
scroll_down_prefix: Styled<&'a str>Prefix for the option listed at the bottom of the page, when it is possible to scroll down.
Note: a space character will be added to separate the prefix and the option value or the checkbox.
selected_checkbox: Styled<&'a str>Selected checkbox in multi-select options.
Note: a space character will be added to separate the checkbox from a possible prefix, and to separate the checkbox from the option value to the right.
unselected_checkbox: Styled<&'a str>Unselected checkbox in multi-select options.
Note: a space character will be added to separate the checkbox from a possible prefix, and to separate the checkbox from the option value to the right.
option_index_prefix: IndexPrefixDefinition of index prefixes in option lists.
option: StyleSheetStyle sheet for options.
Note: a non-styled space character is added before the option value as a separator from the prefix.
selected_option: Option<StyleSheet>Style sheet for the option that is currently selected. If the value is
None, it will fall back to option.
Note: a non-styled space character is added before the option value as a separator from the prefix.
editor_prompt: StyleSheetStyle sheet of the hint in editor prompts.
The hint is formatted as [(e) to open {}, (enter) to submit]
with the editor name.
Implementations§
Source§impl<'a> RenderConfig<'a>
impl<'a> RenderConfig<'a>
Sourcepub fn empty() -> RenderConfig<'a>
pub fn empty() -> RenderConfig<'a>
RenderConfig in which no colors or attributes are applied.
Sourcepub fn default_colored() -> RenderConfig<'a>
pub fn default_colored() -> RenderConfig<'a>
RenderConfig where default colors and attributes are applied.
Sourcepub fn with_prompt_prefix(
self,
prompt_prefix: Styled<&'a str>,
) -> RenderConfig<'a>
pub fn with_prompt_prefix( self, prompt_prefix: Styled<&'a str>, ) -> RenderConfig<'a>
Sets the prompt prefix and its style sheet.
Sourcepub fn with_answered_prompt_prefix(
self,
answered_prompt_prefix: Styled<&'a str>,
) -> RenderConfig<'a>
pub fn with_answered_prompt_prefix( self, answered_prompt_prefix: Styled<&'a str>, ) -> RenderConfig<'a>
Sets the answered prompt prefix and its style sheet.
Sourcepub fn with_text_input(self, text_input: StyleSheet) -> RenderConfig<'a>
pub fn with_text_input(self, text_input: StyleSheet) -> RenderConfig<'a>
Sets style for text inputs.
Sourcepub fn with_default_value(self, default_value: StyleSheet) -> RenderConfig<'a>
pub fn with_default_value(self, default_value: StyleSheet) -> RenderConfig<'a>
Sets the style sheet for default values.
Sourcepub fn with_help_message(self, help_message: StyleSheet) -> RenderConfig<'a>
pub fn with_help_message(self, help_message: StyleSheet) -> RenderConfig<'a>
Sets the style sheet for help messages.
Sourcepub fn with_answer(self, answer: StyleSheet) -> RenderConfig<'a>
pub fn with_answer(self, answer: StyleSheet) -> RenderConfig<'a>
Sets the style sheet for answers.
Sourcepub fn with_error_message(
self,
error_message: ErrorMessageRenderConfig<'a>,
) -> RenderConfig<'a>
pub fn with_error_message( self, error_message: ErrorMessageRenderConfig<'a>, ) -> RenderConfig<'a>
Sets the render configuration for error messages.
Sourcepub fn with_highlighted_option_prefix(
self,
highlighted_option_prefix: Styled<&'a str>,
) -> RenderConfig<'a>
pub fn with_highlighted_option_prefix( self, highlighted_option_prefix: Styled<&'a str>, ) -> RenderConfig<'a>
Sets the styled component for prefixes in highlighted options.
Sourcepub fn with_scroll_up_prefix(
self,
scroll_up_prefix: Styled<&'a str>,
) -> RenderConfig<'a>
pub fn with_scroll_up_prefix( self, scroll_up_prefix: Styled<&'a str>, ) -> RenderConfig<'a>
Sets the styled component for prefixes in scroll-up indicators.
Sourcepub fn with_scroll_down_prefix(
self,
scroll_down_prefix: Styled<&'a str>,
) -> RenderConfig<'a>
pub fn with_scroll_down_prefix( self, scroll_down_prefix: Styled<&'a str>, ) -> RenderConfig<'a>
Sets the styled component for prefixes in scroll-down indicators.
Sourcepub fn with_selected_checkbox(
self,
selected_checkbox: Styled<&'a str>,
) -> RenderConfig<'a>
pub fn with_selected_checkbox( self, selected_checkbox: Styled<&'a str>, ) -> RenderConfig<'a>
Sets the styled component for selected checkboxes.
Sourcepub fn with_unselected_checkbox(
self,
unselected_checkbox: Styled<&'a str>,
) -> RenderConfig<'a>
pub fn with_unselected_checkbox( self, unselected_checkbox: Styled<&'a str>, ) -> RenderConfig<'a>
Sets the styled component for unselected checkboxes.
Sourcepub fn with_option_index_prefix(
self,
index_prefix: IndexPrefix,
) -> RenderConfig<'a>
pub fn with_option_index_prefix( self, index_prefix: IndexPrefix, ) -> RenderConfig<'a>
Sets the index prefix for option lists.
Sourcepub fn with_option(self, option: StyleSheet) -> RenderConfig<'a>
pub fn with_option(self, option: StyleSheet) -> RenderConfig<'a>
Sets the style sheet for option values.
Sourcepub fn with_selected_option(
self,
selected_option: Option<StyleSheet>,
) -> RenderConfig<'a>
pub fn with_selected_option( self, selected_option: Option<StyleSheet>, ) -> RenderConfig<'a>
Sets the style sheet for currently selected option.
Sourcepub fn with_canceled_prompt_indicator(
self,
canceled_prompt_indicator: Styled<&'a str>,
) -> RenderConfig<'a>
pub fn with_canceled_prompt_indicator( self, canceled_prompt_indicator: Styled<&'a str>, ) -> RenderConfig<'a>
Sets the indicator for canceled prompts.
Sourcepub fn with_editor_prompt(self, editor_prompt: StyleSheet) -> RenderConfig<'a>
pub fn with_editor_prompt(self, editor_prompt: StyleSheet) -> RenderConfig<'a>
Sets the render configuration for editor prompts.
Trait Implementations§
Source§impl<'a> Clone for RenderConfig<'a>
impl<'a> Clone for RenderConfig<'a>
Source§fn clone(&self) -> RenderConfig<'a>
fn clone(&self) -> RenderConfig<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for RenderConfig<'a>
impl<'a> Debug for RenderConfig<'a>
Source§impl<'a> Default for RenderConfig<'a>
impl<'a> Default for RenderConfig<'a>
Source§fn default() -> RenderConfig<'a>
fn default() -> RenderConfig<'a>
impl<'a> Copy for RenderConfig<'a>
Auto Trait Implementations§
impl<'a> Freeze for RenderConfig<'a>
impl<'a> RefUnwindSafe for RenderConfig<'a>
impl<'a> Send for RenderConfig<'a>
impl<'a> Sync for RenderConfig<'a>
impl<'a> Unpin for RenderConfig<'a>
impl<'a> UnwindSafe for RenderConfig<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more