[−][src]Struct unsegen_jsonviewer::JsonViewer
A widget for viewing json
data.
Set an initial value during construction (via new
) and replace it either using update
or reset
.
The widgets provides multiple interaction points, for example to fold or unfold structures, or
to grow or shrink the number of elements shown of an array. At any time, one of these knobs is
active. Use select_next
or select_previous
or the Scrollable
implementation to change it.
Call toggle_active_element
to interact with the currently active element.
Interacting with an element might hide it, but the widget takes care to select another element
in that case.
Methods
impl JsonViewer
[src]
pub fn new(value: impl Borrow<JsonValue>) -> Self
[src]
Create a new JsonViewer
widget that will display the specified value.
It follows that it is impossible to not have content. However, it is possible to show an empty String, so there is that.
pub fn reset(&mut self, value: impl Borrow<JsonValue>)
[src]
Set a new value to display and do not highlight any changes (in contrast to update
).
pub fn update(&mut self, value: impl Borrow<JsonValue>)
[src]
Set a new value to display and highlight changes from the previous value (which will be
shown until the next update
or reset
.
pub fn select_next(&mut self) -> Result<(), ()>
[src]
Select the next interaction point of the widget (generally "down" from the current one).
pub fn select_previous(&mut self) -> Result<(), ()>
[src]
Select the previous interaction point of the widget (generally "up" from the current one).
pub fn toggle_active_element(&mut self) -> Result<(), ()>
[src]
Interact with the currently active interaction point and, for example, fold/unfold structures.
Trait Implementations
impl Widget for JsonViewer
[src]
fn space_demand(&self) -> Demand2D
[src]
fn draw(&self, window: Window, hints: RenderingHints)
[src]
impl Scrollable for JsonViewer
[src]
fn scroll_forwards(&mut self) -> OperationResult
[src]
fn scroll_backwards(&mut self) -> OperationResult
[src]
fn scroll_to_beginning(&mut self) -> Result<(), ()>
[src]
fn scroll_to_end(&mut self) -> Result<(), ()>
[src]
Auto Trait Implementations
impl Unpin for JsonViewer
impl Sync for JsonViewer
impl Send for JsonViewer
impl RefUnwindSafe for JsonViewer
impl UnwindSafe for JsonViewer
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,