pub struct Json {
pub renderer: Option<SharedRenderer<Index>>,
pub evaluator: Evaluator<Self>,
pub title: State,
pub json: State,
}Available on crate feature
json only.Expand description
Represents a JSON preset for rendering JSON data and titles with customizable styles.
Fields§
§renderer: Option<SharedRenderer<Index>>Shared renderer for the prompt, allowing for rendering of UI components.
evaluator: Evaluator<Self>Function to evaluate the input events and update the state of the prompt.
title: StateState for the title text.
json: StateState for the JSON data, including formatting and rendering options.
Implementations§
Source§impl Json
impl Json
Sourcepub fn new(stream: JsonStream) -> Self
pub fn new(stream: JsonStream) -> Self
Creates a new JSON preset with the provided JSON stream.
Sourcepub fn title_style(self, style: ContentStyle) -> Self
pub fn title_style(self, style: ContentStyle) -> Self
Sets the style for the title text.
Sourcepub fn json_lines(self, lines: usize) -> Self
pub fn json_lines(self, lines: usize) -> Self
Sets the number of lines to be used for rendering the JSON data.
Sourcepub fn indent(self, indent: usize) -> Self
pub fn indent(self, indent: usize) -> Self
Sets the indentation level for rendering the JSON data.
Sourcepub fn overflow_mode(self, mode: OverflowMode) -> Self
pub fn overflow_mode(self, mode: OverflowMode) -> Self
Sets the overflow mode for rendering JSON values that exceed the available width.
Sourcepub fn active_item_attribute(self, attr: Attribute) -> Self
pub fn active_item_attribute(self, attr: Attribute) -> Self
Sets the attribute for active (currently selected) items.
Sourcepub fn inactive_item_attribute(self, attr: Attribute) -> Self
pub fn inactive_item_attribute(self, attr: Attribute) -> Self
Sets the attribute for inactive (not currently selected) items.
Trait Implementations§
Source§impl Prompt for Json
impl Prompt for Json
Source§fn initialize<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn initialize<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Initializes the handler, preparing it for use.
This method is called before the prompt starts running. Read more
Source§fn evaluate<'life0, 'life1, 'async_trait>(
&'life0 mut self,
event: &'life1 Event,
) -> Pin<Box<dyn Future<Output = Result<Signal>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn evaluate<'life0, 'life1, 'async_trait>(
&'life0 mut self,
event: &'life1 Event,
) -> Pin<Box<dyn Future<Output = Result<Signal>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Evaluates an event and determines the next action for the prompt. Read more
Auto Trait Implementations§
impl Freeze for Json
impl !RefUnwindSafe for Json
impl Send for Json
impl Sync for Json
impl Unpin for Json
impl UnsafeUnpin for Json
impl !UnwindSafe for Json
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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