pub struct JsonView { /* private fields */ }Expand description
Widget that renders pretty-printed JSON with syntax coloring.
Implementations§
Source§impl JsonView
impl JsonView
Sourcepub fn with_indent(self, indent: usize) -> Self
pub fn with_indent(self, indent: usize) -> Self
Set the indentation width.
Sourcepub fn with_key_style(self, style: Style) -> Self
pub fn with_key_style(self, style: Style) -> Self
Set style for object keys.
Sourcepub fn with_string_style(self, style: Style) -> Self
pub fn with_string_style(self, style: Style) -> Self
Set style for string values.
Sourcepub fn with_number_style(self, style: Style) -> Self
pub fn with_number_style(self, style: Style) -> Self
Set style for numbers.
Sourcepub fn with_literal_style(self, style: Style) -> Self
pub fn with_literal_style(self, style: Style) -> Self
Set style for boolean/null literals.
Sourcepub fn with_punct_style(self, style: Style) -> Self
pub fn with_punct_style(self, style: Style) -> Self
Set style for punctuation.
Sourcepub fn with_error_style(self, style: Style) -> Self
pub fn with_error_style(self, style: Style) -> Self
Set style for error text.
Sourcepub fn with_cursor_style(self, style: Style) -> Self
pub fn with_cursor_style(self, style: Style) -> Self
Set the style for the highlighted cursor line in the stateful (foldable) rendering. Defaults to reverse video.
Sourcepub fn set_source(&mut self, source: impl Into<String>)
pub fn set_source(&mut self, source: impl Into<String>)
Set the source JSON.
Sourcepub fn formatted_lines(&self) -> Vec<Vec<JsonToken>>
pub fn formatted_lines(&self) -> Vec<Vec<JsonToken>>
Pretty-format the JSON into lines of tokens for rendering.
Sourcepub fn lines_with_state(&self, state: &JsonViewState) -> Vec<FormattedLine>
pub fn lines_with_state(&self, state: &JsonViewState) -> Vec<FormattedLine>
Format the JSON into display lines honouring state’s fold set: a folded
node collapses to a single placeholder line (key: ▸ {…} (n keys) /
▸ […] (n items)) and its descendants and closing line are hidden. With
the default (empty) state this equals formatted_lines.
Trait Implementations§
Source§impl StatefulWidget for JsonView
impl StatefulWidget for JsonView
Auto Trait Implementations§
impl Freeze for JsonView
impl RefUnwindSafe for JsonView
impl Send for JsonView
impl Sync for JsonView
impl Unpin for JsonView
impl UnsafeUnpin for JsonView
impl UnwindSafe for JsonView
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