pub struct State { /* private fields */ }json-viewer only.Expand description
The document, what is expanded and highlighted, and the search.
Implementations§
Source§impl State
impl State
Sourcepub fn new(value: Value) -> Self
pub fn new(value: Value) -> Self
A viewer of value with everything collapsed. An object or array
shows its members as the top rows; anything else shows as one row.
Sourcepub fn parse(json: &str) -> Self
pub fn parse(json: &str) -> Self
Parses JSON text. Text that is not valid JSON gives an empty viewer
that shows the error in place of rows.
Sourcepub fn with_depth(self, depth: usize) -> Self
pub fn with_depth(self, depth: usize) -> Self
Starts with every object and array fewer than depth levels deep
expanded.
Sourcepub fn with_only_matches(self, only_matches: bool) -> Self
pub fn with_only_matches(self, only_matches: bool) -> Self
Starts with only the matches shown while searching.
Sourcepub fn with_search_id(self, id: impl Into<Id>) -> Self
pub fn with_search_id(self, id: impl Into<Id>) -> Self
The search box’s widget id. Defaults to SEARCH; give each viewer
its own when a window has several.
Sourcepub fn search_id(&self) -> &Id
pub fn search_id(&self) -> &Id
The search box’s widget id, which focus_search focuses.
Sourcepub fn error(&self) -> Option<&ParseError>
pub fn error(&self) -> Option<&ParseError>
Why the text given to parse is not valid JSON.
pub fn is_empty(&self) -> bool
pub fn kind(&self, id: NodeId) -> Option<Kind>
Sourcepub fn segment(&self, id: NodeId) -> Option<&Segment>
pub fn segment(&self, id: NodeId) -> Option<&Segment>
The key or index the node has in its parent, None for the document.
pub fn children(&self, id: NodeId) -> &[NodeId]
pub fn is_expanded(&self, id: NodeId) -> bool
Sourcepub fn highlighted(&self) -> Option<NodeId>
pub fn highlighted(&self) -> Option<NodeId>
The node the keyboard acts on.
pub fn is_focused(&self) -> bool
Sourcepub fn matches(&self) -> &[NodeId]
pub fn matches(&self) -> &[NodeId]
The nodes whose key or value contains the search text, in document order.
pub fn is_match(&self, id: NodeId) -> bool
Sourcepub fn current_match(&self) -> Option<NodeId>
pub fn current_match(&self) -> Option<NodeId>
The match Event::NextMatch last moved to.
Sourcepub fn is_filtering(&self) -> bool
pub fn is_filtering(&self) -> bool
Whether only matches are shown: only_matches
is on and there is a search.
Sourcepub fn only_matches(&self) -> bool
pub fn only_matches(&self) -> bool
Whether a search shows only its matches, searching or not.
Sourcepub fn visible(&self) -> Vec<NodeId>
pub fn visible(&self) -> Vec<NodeId>
The rows on screen when scrolled through, in document order.
Sourcepub fn path(&self, id: NodeId) -> String
pub fn path(&self, id: NodeId) -> String
The node’s path from the document, such as $.users[2].name or
$["first name"].
Trait Implementations§
Auto Trait Implementations§
impl Freeze for State
impl RefUnwindSafe for State
impl Send for State
impl Sync for State
impl Unpin for State
impl UnsafeUnpin for State
impl UnwindSafe for State
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Application.