formations

Crates.ioformations
lib.rsformations
version0.1.0
sourcesrc
created_at2021-07-24 11:14:52.117282
updated_at2021-07-24 11:14:52.117282
descriptionA terminal forms/multiple choice library
homepage
repositoryhttps://gitlab.com/john_t/formations
max_upload_size
id426715
size23,748
John Toohey (greenfierydragon)

documentation

README

Formations

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(())
}
Commit count: 4

cargo fmt