mindustry logic execution, map- and schematic- parsing and rendering
Diffstat (limited to 'src/args.rs')
| -rw-r--r-- | src/args.rs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/args.rs b/src/args.rs index ee06dec..62a2596 100644 --- a/src/args.rs +++ b/src/args.rs @@ -122,6 +122,45 @@ pub enum OptionValue Value(String), } +impl OptionValue +{ + pub const fn is_absent(&self) -> bool + { + match self + { + OptionValue::Absent => true, + _ => false, + } + } + + pub const fn is_present(&self) -> bool + { + match self + { + OptionValue::Present | OptionValue::Value(..) => true, + _ => false, + } + } + + pub const fn has_value(&self) -> bool + { + match self + { + OptionValue::Value(..) => true, + _ => false, + } + } + + pub const fn get_value(&self) -> Option<&String> + { + match self + { + OptionValue::Value(v) => Some(v), + _ => None, + } + } +} + #[derive(Clone, Debug)] pub struct OptionHandler { |