pub struct Tree { /* private fields */ }Expand description
A foldable, editable JSON/YAML value tree with a cursor and undo history.
Implementations§
Source§impl Tree
impl Tree
Sourcepub fn from_text(text: &str, format: Format) -> Option<Self>
pub fn from_text(text: &str, format: Format) -> Option<Self>
Parse text as JSON or YAML into a value tree. Returns None when the
text does not parse (the host can warn). YAML’s parser also accepts JSON.
Sourcepub fn is_editing(&self) -> bool
pub fn is_editing(&self) -> bool
Whether a scalar is currently being edited.
Sourcepub fn edit_buffer(&self) -> &str
pub fn edit_buffer(&self) -> &str
The in-progress edit text (valid while Tree::is_editing).
Sourcepub fn is_container(&self, i: usize) -> bool
pub fn is_container(&self, i: usize) -> bool
Whether visible row i is a container (object/array).
Sourcepub fn is_collapsed(&self, i: usize) -> bool
pub fn is_collapsed(&self, i: usize) -> bool
Whether visible row i is a collapsed container.
Sourcepub fn mark_saved(&mut self)
pub fn mark_saved(&mut self)
Mark the tree as saved (called by the host after a successful write).
Sourcepub fn ensure_visible(&mut self, height: usize)
pub fn ensure_visible(&mut self, height: usize)
Adjust the scroll so the selected row stays within a height-row window.
Sourcepub fn handle_key(&mut self, key: KeyEvent, page: usize) -> Outcome
pub fn handle_key(&mut self, key: KeyEvent, page: usize) -> Outcome
Interpret a key event and report what the host should do next.
Auto Trait Implementations§
impl Freeze for Tree
impl RefUnwindSafe for Tree
impl Send for Tree
impl Sync for Tree
impl Unpin for Tree
impl UnsafeUnpin for Tree
impl UnwindSafe for Tree
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