use std::string::String;
/// Name of an option. Either a string or a single char.
-#[deriving(Clone, PartialEq)]
+#[deriving(Clone, PartialEq, Eq)]
pub enum Name {
/// A string representing the long name of an option.
/// For example: "help"
}
/// Describes whether an option has an argument.
-#[deriving(Clone, PartialEq)]
+#[deriving(Clone, PartialEq, Eq)]
pub enum HasArg {
/// The option requires an argument.
Yes,
}
/// Describes how often an option may occur.
-#[deriving(Clone, PartialEq)]
+#[deriving(Clone, PartialEq, Eq)]
pub enum Occur {
/// The option occurs once.
Req,
}
/// A description of a possible option.
-#[deriving(Clone, PartialEq)]
+#[deriving(Clone, PartialEq, Eq)]
pub struct Opt {
/// Name of the option
pub name: Name,
/// How often it can occur
pub occur: Occur,
/// Which options it aliases
- pub aliases: Vec<Opt> ,
+ pub aliases: Vec<Opt>,
}
/// One group of options, e.g., both -h and --help, along with
/// their shared description and properties.
-#[deriving(Clone, PartialEq)]
+#[deriving(Clone, PartialEq, Eq)]
pub struct OptGroup {
/// Short Name of the `OptGroup`
pub short_name: String,
}
/// Describes whether an option is given at all or has a value.
-#[deriving(Clone, PartialEq)]
+#[deriving(Clone, PartialEq, Eq)]
enum Optval {
Val(String),
Given,
/// The result of checking command line arguments. Contains a vector
/// of matches and a vector of free strings.
-#[deriving(Clone, PartialEq)]
+#[deriving(Clone, PartialEq, Eq)]
pub struct Matches {
/// Options that matched
- opts: Vec<Opt> ,
+ opts: Vec<Opt>,
/// Values of the Options that matched
- vals: Vec<Vec<Optval> > ,
+ vals: Vec<Vec<Optval>>,
/// Free string fragments
pub free: Vec<String>,
}
/// The type returned when the command line does not conform to the
/// expected format. Use the `Show` implementation to output detailed
/// information.
-#[deriving(Clone, PartialEq)]
+#[deriving(Clone, PartialEq, Eq)]
pub enum Fail_ {
/// The option requires an argument but none was passed.
ArgumentMissing(String),
}
/// The type of failure that occurred.
-#[deriving(PartialEq)]
+#[deriving(PartialEq, Eq)]
#[allow(missing_doc)]
pub enum FailType {
ArgumentMissing_,