Expand description
Interface mode — Gradio-style fn → UI automatic generation.
Wraps a plain Rust function and automatically generates input/output widgets
based on type inference. Inspired by Gradio’s gr.Interface(fn, inputs, outputs).
§Example
fn greet(name: String) -> String {
format!("Hello, {}!", name)
}
fn main() {
rustview::Interface::from_fn(greet)
.title("Greeter")
.description("Enter a name to greet.")
.launch();
}§Type Inference Rules
| Rust Type | Input Widget | Output Widget |
|---|---|---|
String | text_input | write |
f64 | number_input | metric |
f32 | number_input | metric |
i64 | int_input | metric |
bool | checkbox | write |
Vec<String> | multi_select | json |
(A, B) | — | two-field output |
Structs§
- Interface
- The Interface builder — wraps a function and generates a complete UI.
Traits§
- Widget
Input - Trait for types that can be automatically rendered as an input widget.
- Widget
Output - Trait for types that can be automatically rendered as an output widget.