Crates.io | formations |
lib.rs | formations |
version | 0.1.0 |
source | src |
created_at | 2021-07-24 11:14:52.117282 |
updated_at | 2021-07-24 11:14:52.117282 |
description | A terminal forms/multiple choice library |
homepage | |
repository | https://gitlab.com/john_t/formations |
max_upload_size | |
id | 426715 |
size | 23,748 |
Formations is a rust library to allow you to easily create terminal forms, where a user is presented with multiple options and has to pick one. It looks something like:
1) Option 1 2) Option 2
3) Option 3 4) Option 4
It can be programmed as follows:
use formations::FormElement;
fn main() -> std::io::Result<()> {
println!("Pick your favourite pet.");
let mut form = vec![
FormElement::new("cat", "Small mammal with fur"),
FormElement::new("dog", "Likes a bone"),
FormElement::new("mouse", "Likes cheese"),
];
println!("{}", FormElement::run(&form)?.description.unwrap());
Ok(())
}