easy_input_tools 0.1.0

A library for easy input tools
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::collections::HashSet;
use std::io::Result;


pub fn checkbox(options: &Vec<&str>) -> Result<HashSet<usize>> {
    crate::custom::checkbox(
        options,
        |option, i, selected, selection| {
            format!(
                "{}{}{} {}",
                if i == selected { ">" } else { "[" },
                if selection.contains(&i) { "x" } else { " " },
                if i == selected { "<" } else { "]" },
                option,
            ).into()
        },
    )
}