pub struct CheckboxList<'a, T> { /* private fields */ }Implementations§
Source§impl<'a, T> CheckboxList<'a, T>
impl<'a, T> CheckboxList<'a, T>
Sourcepub fn new(message: &'a str) -> Self
pub fn new(message: &'a str) -> Self
Examples found in repository?
examples/checkbox_list.rs (line 2)
1fn main() {
2 let result = CheckboxList::<&'static str>::new("Please select an option:")
3 .add_item("Option 1", "version 2.4")
4 .add_item("Option 2", "version 2.5")
5 .add_item("Option 3", "version 2.6")
6 .inquire();
7
8 match result {
9 Ok(..) => {}
10 Err(error) => match error {
11 InquiryMessage::CloseRequested => return,
12 _ => panic!(
13 "There was an other error encoutered that shouldn't \
14 happen."
15 ),
16 },
17 }
18}Sourcepub fn add_item(self, selection_name: &'a str, item: T) -> Self
pub fn add_item(self, selection_name: &'a str, item: T) -> Self
Examples found in repository?
examples/checkbox_list.rs (line 3)
1fn main() {
2 let result = CheckboxList::<&'static str>::new("Please select an option:")
3 .add_item("Option 1", "version 2.4")
4 .add_item("Option 2", "version 2.5")
5 .add_item("Option 3", "version 2.6")
6 .inquire();
7
8 match result {
9 Ok(..) => {}
10 Err(error) => match error {
11 InquiryMessage::CloseRequested => return,
12 _ => panic!(
13 "There was an other error encoutered that shouldn't \
14 happen."
15 ),
16 },
17 }
18}Sourcepub fn inquire(self) -> Result<Vec<T>, InquiryMessage>
pub fn inquire(self) -> Result<Vec<T>, InquiryMessage>
Examples found in repository?
examples/checkbox_list.rs (line 6)
1fn main() {
2 let result = CheckboxList::<&'static str>::new("Please select an option:")
3 .add_item("Option 1", "version 2.4")
4 .add_item("Option 2", "version 2.5")
5 .add_item("Option 3", "version 2.6")
6 .inquire();
7
8 match result {
9 Ok(..) => {}
10 Err(error) => match error {
11 InquiryMessage::CloseRequested => return,
12 _ => panic!(
13 "There was an other error encoutered that shouldn't \
14 happen."
15 ),
16 },
17 }
18}Auto Trait Implementations§
impl<'a, T> Freeze for CheckboxList<'a, T>
impl<'a, T> RefUnwindSafe for CheckboxList<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for CheckboxList<'a, T>where
T: Send,
impl<'a, T> Sync for CheckboxList<'a, T>where
T: Sync,
impl<'a, T> Unpin for CheckboxList<'a, T>where
T: Unpin,
impl<'a, T> UnwindSafe for CheckboxList<'a, T>where
T: UnwindSafe,
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