#[non_exhaustive]pub enum CanvasElement {
Text {
content: String,
format: String,
},
Button {
label: String,
action: String,
disabled: bool,
},
Input {
label: String,
placeholder: String,
value: String,
},
Image {
src: String,
alt: String,
},
Code {
code: String,
language: String,
},
Table {
headers: Vec<String>,
rows: Vec<Vec<String>>,
},
Form {
fields: Vec<FormField>,
submit_action: String,
},
Chart {
data: Vec<ChartDataPoint>,
chart_type: String,
title: Option<String>,
colors: Option<Vec<String>>,
},
CodeEditor {
code: String,
language: String,
editable: bool,
line_numbers: bool,
},
FormAdvanced {
fields: Vec<AdvancedFormField>,
submit_action: Option<String>,
},
}Expand description
UI element types that agents can render on the canvas.
Each variant represents a different UI primitive. The type field
is used as the serde tag for JSON serialization.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Text
A text block with optional formatting.
Button
A clickable button that triggers an action.
Input
A text input field.
Image
An image element.
Code
A code block with optional syntax highlighting.
Table
A data table with headers and rows.
Form
A form with multiple fields and a submit action.
Chart
A chart element for data visualization.
Fields
§
data: Vec<ChartDataPoint>CodeEditor
A code editor element with optional editing and line numbers.
FormAdvanced
An advanced form with typed fields and validation.
Trait Implementations§
Source§impl Clone for CanvasElement
impl Clone for CanvasElement
Source§fn clone(&self) -> CanvasElement
fn clone(&self) -> CanvasElement
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CanvasElement
impl Debug for CanvasElement
Source§impl<'de> Deserialize<'de> for CanvasElement
impl<'de> Deserialize<'de> for CanvasElement
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 CanvasElement
impl PartialEq for CanvasElement
Source§impl Serialize for CanvasElement
impl Serialize for CanvasElement
impl StructuralPartialEq for CanvasElement
Auto Trait Implementations§
impl Freeze for CanvasElement
impl RefUnwindSafe for CanvasElement
impl Send for CanvasElement
impl Sync for CanvasElement
impl Unpin for CanvasElement
impl UnsafeUnpin for CanvasElement
impl UnwindSafe for CanvasElement
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