diff options
author | Griffin Smith <root@gws.fyi> | 2019-08-25T17·25-0400 |
---|---|---|
committer | Griffin Smith <root@gws.fyi> | 2019-08-25T17·25-0400 |
commit | fb0d1b3e66251aa56a3df1d05fd4b82b33380a31 (patch) | |
tree | 367edbe5f504a3eb8130e5e0a8dd695fbbc65684 /src/types/menu.rs | |
parent | e2d2f011c6373894b3cdcfbdb98fbc783504561a (diff) |
Wipe Rust project
Sorry rust, but you're just not fun to write
Diffstat (limited to 'src/types/menu.rs')
-rw-r--r-- | src/types/menu.rs | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/src/types/menu.rs b/src/types/menu.rs deleted file mode 100644 index 63abc837788e..000000000000 --- a/src/types/menu.rs +++ /dev/null @@ -1,31 +0,0 @@ -use crate::types::Dimensions; - -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct MenuInfo { - pub prompt: String, - pub options: Vec<String>, -} - -impl MenuInfo { - pub fn new(prompt: String, options: Vec<String>) -> Self { - MenuInfo { prompt, options } - } - - /// Returns the inner dimensions of a box necessary to draw this menu. Will - /// not trim either dimension to the size of the terminal - pub fn dimensions(&self) -> Dimensions { - Dimensions { - w: self - .options - .iter() - .map(|s| s.len()) - .max() - .unwrap_or(0) - .max(self.prompt.len()) as u16 - + 4, - h: self.options.len() as u16 - + if self.prompt.is_empty() { 0 } else { 2 } - + 4, - } - } -} |