pub struct JsonViewState {
pub cursor_line: usize,
pub scroll: usize,
/* private fields */
}Expand description
Fold state and cursor for a JsonView rendered as a StatefulWidget.
Owned by the caller (like List/Table state). Folds are keyed by
JsonPath. After each render the visible foldable paths are cached so
handle_event can resolve the cursor line to
a node without borrowing the view.
Fields§
§cursor_line: usizeThe highlighted line (index into the visible lines).
scroll: usizeFirst visible line (vertical scroll offset).
Implementations§
Source§impl JsonViewState
impl JsonViewState
Sourcepub fn unfold_all(&mut self)
pub fn unfold_all(&mut self)
Unfold everything.
Sourcepub fn folded_count(&self) -> usize
pub fn folded_count(&self) -> usize
Number of folded nodes.
Sourcepub fn handle_event(&mut self, event: &Event) -> bool
pub fn handle_event(&mut self, event: &Event) -> bool
Handle a key event against the last rendered layout: Enter/Space
toggle the node on the cursor line (no-op on a leaf), Up/Down move
the cursor, PageUp/PageDown move by ten, Home/End jump to the
ends. Returns whether the state changed. Requires a prior render to have
cached the visible layout.
Trait Implementations§
Source§impl Clone for JsonViewState
impl Clone for JsonViewState
Source§fn clone(&self) -> JsonViewState
fn clone(&self) -> JsonViewState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for JsonViewState
impl Debug for JsonViewState
Source§impl Default for JsonViewState
impl Default for JsonViewState
Source§fn default() -> JsonViewState
fn default() -> JsonViewState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for JsonViewState
impl RefUnwindSafe for JsonViewState
impl Send for JsonViewState
impl Sync for JsonViewState
impl Unpin for JsonViewState
impl UnsafeUnpin for JsonViewState
impl UnwindSafe for JsonViewState
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