Skip to main content

Node

Enum Node 

Source
pub enum Node {
Show 26 variants Layout(Layout), Block(Block), Paragraph(Paragraph), List(List), Table(Table), Tabs(Tabs), Gauge(Gauge), LineGauge(LineGauge), Sparkline(Sparkline), BarChart(BarChart), Chart(Chart), Scrollbar(Scrollbar), Markdown(Markdown), Code(Code), Diff(Diff), Image(Image), Log(Log), Tree(Tree), KeyHints(KeyHints), Input(Input), Toggle(Toggle), Select(Select), Button(Button), Spinner(Spinner), Empty(Empty), Unknown(Unknown),
}
Expand description

One widget-tree node (§4): {"t": "<Kind>", ...}.

Parsing is tolerant (§4.8 / D-U14): unknown props are ignored, unknown kinds become Node::Unknown. Serialization emits exactly the Appendix A fields.

Variants§

§

Layout(Layout)

Container; children solved on the main axis (§4.3).

§

Block(Block)

Chrome around a child (§4.5.1).

§

Paragraph(Paragraph)

Wrapped text (§4.5.1).

§

List(List)

Selectable list (§4.5.1).

§

Table(Table)

Column table (§4.5.1).

§

Tabs(Tabs)

Tab bar (+ optional local panes) (§4.5.1).

§

Gauge(Gauge)

Progress bar (§4.5.1).

§

LineGauge(LineGauge)

One-row progress line (§4.5.1).

§

Sparkline(Sparkline)

Value series as bars (§4.5.1).

§

BarChart(BarChart)

Grouped bars (§4.5.1).

§

Chart(Chart)

Scatter / line / bar plot (§4.5.1).

§

Scrollbar(Scrollbar)

Scroll position indicator (§4.5.1).

§

Markdown(Markdown)

Markdown text (§4.5.2).

§

Code(Code)

Syntax-highlighted code (§4.5.2).

§

Diff(Diff)

Unified / split diff (§4.5.2).

§

Image(Image)

Image (§4.5.2).

§

Log(Log)

Tailing log (§4.5.2).

§

Tree(Tree)

Expandable tree (§4.5.2).

§

KeyHints(KeyHints)

Key hints line (§4.5.2).

§

Input(Input)

Text field (§4.5.2).

§

Toggle(Toggle)

Boolean switch (§4.5.2).

§

Select(Select)

Cycling select (§4.5.2).

§

Button(Button)

Action button (§4.5.2).

§

Spinner(Spinner)

Activity indicator (§4.5.2).

§

Empty(Empty)

Empty state (§4.5.2).

§

Unknown(Unknown)

Unknown kind (§4.8).

Implementations§

Source§

impl Node

Source

pub fn tag(&self) -> Option<&'static str>

The node’s tag, or None for Node::Unknown (use Unknown::t).

Source

pub fn kind(&self) -> &str

The node’s tag, including unknown ones.

Source

pub fn common(&self) -> CommonRef<'_>

Shared borrow of the common props (the unknown kind keeps a subset).

Trait Implementations§

Source§

impl Clone for Node

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Node

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Node

Source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<BarChart> for Node

Source§

fn from(c: BarChart) -> Self

Converts to this type from the input type.
Source§

impl From<Block> for Node

Source§

fn from(b: Block) -> Self

Converts to this type from the input type.
Source§

impl From<Button> for Node

Source§

fn from(b: Button) -> Self

Converts to this type from the input type.
Source§

impl From<Chart> for Node

Source§

fn from(c: Chart) -> Self

Converts to this type from the input type.
Source§

impl From<Code> for Node

Source§

fn from(c: Code) -> Self

Converts to this type from the input type.
Source§

impl From<Diff> for Node

Source§

fn from(d: Diff) -> Self

Converts to this type from the input type.
Source§

impl From<Empty> for Node

Source§

fn from(e: Empty) -> Self

Converts to this type from the input type.
Source§

impl From<Gauge> for Node

Source§

fn from(g: Gauge) -> Self

Converts to this type from the input type.
Source§

impl From<Image> for Node

Source§

fn from(i: Image) -> Self

Converts to this type from the input type.
Source§

impl From<Input> for Node

Source§

fn from(i: Input) -> Self

Converts to this type from the input type.
Source§

impl From<KeyHints> for Node

Source§

fn from(k: KeyHints) -> Self

Converts to this type from the input type.
Source§

impl From<Layout> for Node

Source§

fn from(l: Layout) -> Self

Converts to this type from the input type.
Source§

impl From<LineGauge> for Node

Source§

fn from(g: LineGauge) -> Self

Converts to this type from the input type.
Source§

impl From<List> for Node

Source§

fn from(l: List) -> Self

Converts to this type from the input type.
Source§

impl From<Log> for Node

Source§

fn from(l: Log) -> Self

Converts to this type from the input type.
Source§

impl From<Markdown> for Node

Source§

fn from(m: Markdown) -> Self

Converts to this type from the input type.
Source§

impl From<Node> for PatchItem

Source§

fn from(node: Node) -> Self

Converts to this type from the input type.
Source§

impl From<Paragraph> for Node

Source§

fn from(p: Paragraph) -> Self

Converts to this type from the input type.
Source§

impl From<Scrollbar> for Node

Source§

fn from(s: Scrollbar) -> Self

Converts to this type from the input type.
Source§

impl From<Select> for Node

Source§

fn from(s: Select) -> Self

Converts to this type from the input type.
Source§

impl From<Sparkline> for Node

Source§

fn from(s: Sparkline) -> Self

Converts to this type from the input type.
Source§

impl From<Spinner> for Node

Source§

fn from(s: Spinner) -> Self

Converts to this type from the input type.
Source§

impl From<Table> for Node

Source§

fn from(t: Table) -> Self

Converts to this type from the input type.
Source§

impl From<Tabs> for Node

Source§

fn from(t: Tabs) -> Self

Converts to this type from the input type.
Source§

impl From<Toggle> for Node

Source§

fn from(t: Toggle) -> Self

Converts to this type from the input type.
Source§

impl From<Tree> for Node

Source§

fn from(t: Tree) -> Self

Converts to this type from the input type.
Source§

impl IntoNode for Node

Source§

fn into_node(self) -> Node

Converts into a node.
Source§

impl PartialEq for Node

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Node

Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Node

Auto Trait Implementations§

§

impl Freeze for Node

§

impl RefUnwindSafe for Node

§

impl Send for Node

§

impl Sync for Node

§

impl Unpin for Node

§

impl UnsafeUnpin for Node

§

impl UnwindSafe for Node

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.