Skip to main content

Kind

Enum Kind 

Source
pub enum Kind {
Show 17 variants Column { children: Vec<Node>, }, Row { children: Vec<Node>, }, Card { title: String, children: Vec<Node>, }, Text { text: String, style: TextStyle, tone: Tone, }, Markdown { text: String, }, Chip { text: String, tone: Tone, }, Button { label: String, action: String, primary: bool, danger: bool, }, Input { name: String, value: String, placeholder: String, submit: Option<String>, }, Toggle { name: String, label: String, value: bool, action: Option<String>, }, Select { name: String, options: Vec<String>, value: String, action: Option<String>, }, Progress { value: f32, label: String, }, Table { name: String, columns: Vec<TableColumn>, rows: Vec<Vec<Value>>, height: Option<f32>, select: Option<String>, }, Chart { spec: ChartSpec, }, Separator {}, Image { media: Option<String>, artifact: Option<String>, alt: String, width: Option<f32>, height: Option<f32>, }, Canvas { width: f32, height: f32, shapes: Vec<Shape>, action: Option<String>, }, Grid { name: String, rows: u32, cols: u32, blocks: Vec<GridBlock>, frozen_rows: u32, frozen_cols: u32, widths: BTreeMap<u32, f32>, default_width: Option<f32>, editable: bool, headers: bool, height: Option<f32>, selection: Option<GridRange>, },
}
Expand description

What a node is ("type" in JSON).

Variants§

§

Column

Children stacked top to bottom.

Fields

§children: Vec<Node>
§

Row

Children side by side (wrapping); a row holding cards or columns splits the width equally between them.

Fields

§children: Vec<Node>
§

Card

A framed box with an optional title.

Fields

§title: String
§children: Vec<Node>
§

Text

Fields

§text: String
§tone: Tone
§

Markdown

Fields

§text: String
§

Chip

A small status pill.

Fields

§text: String
§tone: Tone
§

Button

Fields

§label: String
§action: String

Sent as the event’s action.

§primary: bool
§danger: bool
§

Input

A one-line text field; its text is values[name] in every event.

Fields

§name: String
§value: String
§placeholder: String
§submit: Option<String>

Action sent when Enter is pressed in it.

§

Toggle

A checkbox; values[name] is a bool.

Fields

§name: String
§label: String
§value: bool
§action: Option<String>

Action sent when it is flipped.

§

Select

A drop-down; values[name] is the chosen option.

Fields

§name: String
§options: Vec<String>
§value: String
§action: Option<String>

Action sent when the choice changes.

§

Progress

A bar, value from 0 to 1.

Fields

§value: f32
§label: String
§

Table

Rows of cells, drawn virtualized (only what is on screen), with editable columns.

Fields

§name: String

Names the table in edit events and is values[name] (the selected row).

§columns: Vec<TableColumn>
§rows: Vec<Vec<Value>>

Cells in column order: strings, numbers, booleans or null.

§height: Option<f32>

Tallest the table is drawn (points; it scrolls inside).

§select: Option<String>

Action sent when a row is clicked (values[name] is its index).

§

Chart

A chart: the same spec as .chart.json artifacts.

Fields

§

Separator

§

Image

An image from the chat’s media (a workspace path) or an artifact.

Fields

§media: Option<String>

A workspace path, as in a media reference.

§artifact: Option<String>

An artifact id.

§width: Option<f32>
§height: Option<f32>
§

Canvas

A display list: shapes in a width × height box (scaled down to fit).

Fields

§width: f32
§height: f32
§shapes: Vec<Shape>
§action: Option<String>

Action sent on a click, with the point in values._x / values._y (canvas units).

§

Grid

A spreadsheet: a rows × cols sheet of which the client has the cells in blocks and asks for others (a window event) as the user scrolls. Its events carry a GridEvent; values[name] is the selection (a GridRange).

Fields

§name: String

Names the grid in events and is values[name].

§rows: u32
§cols: u32
§blocks: Vec<GridBlock>

Rectangles of known cells; the rest aren’t loaded.

§frozen_rows: u32

Data rows (from the top) that stay put while scrolling.

§frozen_cols: u32

Data columns (from the left) that stay put while scrolling.

§widths: BTreeMap<u32, f32>

Column index → width in points.

§default_width: Option<f32>

Width of the other columns (GRID_DEFAULT_WIDTH if not given).

§editable: bool

Cells can be edited, cleared and pasted into.

§headers: bool

Column letters and row numbers.

§height: Option<f32>

Tallest the grid is drawn (points); else the height its site gives.

§selection: Option<GridRange>

The selection to show (taken when the tree changes it, like a field’s value).

Implementations§

Source§

impl Kind

Source

pub fn type_name(&self) -> &'static str

Trait Implementations§

Source§

impl Clone for Kind

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 Kind

Source§

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

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

impl<'de> Deserialize<'de> for Kind

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

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

impl PartialEq for Kind

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 Kind

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

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

impl StructuralPartialEq for Kind

Auto Trait Implementations§

§

impl Forget for Kind

§

impl Freeze for Kind

§

impl Move for Kind

§

impl RefUnwindSafe for Kind

§

impl Send for Kind

§

impl Sync for Kind

§

impl Unpin for Kind

§

impl UnsafeUnpin for Kind

§

impl UnwindSafe for Kind

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.