getopts: derive Eq for types.
This commit is contained in:
parent
0642cbbde0
commit
09eb95f241
@ -100,7 +100,7 @@ use std::result;
|
|||||||
use std::string::String;
|
use std::string::String;
|
||||||
|
|
||||||
/// Name of an option. Either a string or a single char.
|
/// Name of an option. Either a string or a single char.
|
||||||
#[deriving(Clone, PartialEq)]
|
#[deriving(Clone, PartialEq, Eq)]
|
||||||
pub enum Name {
|
pub enum Name {
|
||||||
/// A string representing the long name of an option.
|
/// A string representing the long name of an option.
|
||||||
/// For example: "help"
|
/// For example: "help"
|
||||||
@ -111,7 +111,7 @@ pub enum Name {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Describes whether an option has an argument.
|
/// Describes whether an option has an argument.
|
||||||
#[deriving(Clone, PartialEq)]
|
#[deriving(Clone, PartialEq, Eq)]
|
||||||
pub enum HasArg {
|
pub enum HasArg {
|
||||||
/// The option requires an argument.
|
/// The option requires an argument.
|
||||||
Yes,
|
Yes,
|
||||||
@ -122,7 +122,7 @@ pub enum HasArg {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Describes how often an option may occur.
|
/// Describes how often an option may occur.
|
||||||
#[deriving(Clone, PartialEq)]
|
#[deriving(Clone, PartialEq, Eq)]
|
||||||
pub enum Occur {
|
pub enum Occur {
|
||||||
/// The option occurs once.
|
/// The option occurs once.
|
||||||
Req,
|
Req,
|
||||||
@ -133,7 +133,7 @@ pub enum Occur {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A description of a possible option.
|
/// A description of a possible option.
|
||||||
#[deriving(Clone, PartialEq)]
|
#[deriving(Clone, PartialEq, Eq)]
|
||||||
pub struct Opt {
|
pub struct Opt {
|
||||||
/// Name of the option
|
/// Name of the option
|
||||||
pub name: Name,
|
pub name: Name,
|
||||||
@ -147,7 +147,7 @@ pub struct Opt {
|
|||||||
|
|
||||||
/// One group of options, e.g., both -h and --help, along with
|
/// One group of options, e.g., both -h and --help, along with
|
||||||
/// their shared description and properties.
|
/// their shared description and properties.
|
||||||
#[deriving(Clone, PartialEq)]
|
#[deriving(Clone, PartialEq, Eq)]
|
||||||
pub struct OptGroup {
|
pub struct OptGroup {
|
||||||
/// Short Name of the `OptGroup`
|
/// Short Name of the `OptGroup`
|
||||||
pub short_name: String,
|
pub short_name: String,
|
||||||
@ -164,7 +164,7 @@ pub struct OptGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Describes whether an option is given at all or has a value.
|
/// Describes whether an option is given at all or has a value.
|
||||||
#[deriving(Clone, PartialEq)]
|
#[deriving(Clone, PartialEq, Eq)]
|
||||||
enum Optval {
|
enum Optval {
|
||||||
Val(String),
|
Val(String),
|
||||||
Given,
|
Given,
|
||||||
@ -172,7 +172,7 @@ enum Optval {
|
|||||||
|
|
||||||
/// The result of checking command line arguments. Contains a vector
|
/// The result of checking command line arguments. Contains a vector
|
||||||
/// of matches and a vector of free strings.
|
/// of matches and a vector of free strings.
|
||||||
#[deriving(Clone, PartialEq)]
|
#[deriving(Clone, PartialEq, Eq)]
|
||||||
pub struct Matches {
|
pub struct Matches {
|
||||||
/// Options that matched
|
/// Options that matched
|
||||||
opts: Vec<Opt>,
|
opts: Vec<Opt>,
|
||||||
@ -185,7 +185,7 @@ pub struct Matches {
|
|||||||
/// The type returned when the command line does not conform to the
|
/// The type returned when the command line does not conform to the
|
||||||
/// expected format. Use the `Show` implementation to output detailed
|
/// expected format. Use the `Show` implementation to output detailed
|
||||||
/// information.
|
/// information.
|
||||||
#[deriving(Clone, PartialEq)]
|
#[deriving(Clone, PartialEq, Eq)]
|
||||||
pub enum Fail_ {
|
pub enum Fail_ {
|
||||||
/// The option requires an argument but none was passed.
|
/// The option requires an argument but none was passed.
|
||||||
ArgumentMissing(String),
|
ArgumentMissing(String),
|
||||||
@ -200,7 +200,7 @@ pub enum Fail_ {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The type of failure that occurred.
|
/// The type of failure that occurred.
|
||||||
#[deriving(PartialEq)]
|
#[deriving(PartialEq, Eq)]
|
||||||
#[allow(missing_doc)]
|
#[allow(missing_doc)]
|
||||||
pub enum FailType {
|
pub enum FailType {
|
||||||
ArgumentMissing_,
|
ArgumentMissing_,
|
||||||
|
Loading…
Reference in New Issue
Block a user