Skip to content

Commit 09eb95f

Browse files
committed
getopts: derive Eq for types.
1 parent 0642cbb commit 09eb95f

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/libgetopts/lib.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ use std::result;
100100
use std::string::String;
101101

102102
/// Name of an option. Either a string or a single char.
103-
#[deriving(Clone, PartialEq)]
103+
#[deriving(Clone, PartialEq, Eq)]
104104
pub enum Name {
105105
/// A string representing the long name of an option.
106106
/// For example: "help"
@@ -111,7 +111,7 @@ pub enum Name {
111111
}
112112

113113
/// Describes whether an option has an argument.
114-
#[deriving(Clone, PartialEq)]
114+
#[deriving(Clone, PartialEq, Eq)]
115115
pub enum HasArg {
116116
/// The option requires an argument.
117117
Yes,
@@ -122,7 +122,7 @@ pub enum HasArg {
122122
}
123123

124124
/// Describes how often an option may occur.
125-
#[deriving(Clone, PartialEq)]
125+
#[deriving(Clone, PartialEq, Eq)]
126126
pub enum Occur {
127127
/// The option occurs once.
128128
Req,
@@ -133,7 +133,7 @@ pub enum Occur {
133133
}
134134

135135
/// A description of a possible option.
136-
#[deriving(Clone, PartialEq)]
136+
#[deriving(Clone, PartialEq, Eq)]
137137
pub struct Opt {
138138
/// Name of the option
139139
pub name: Name,
@@ -142,12 +142,12 @@ pub struct Opt {
142142
/// How often it can occur
143143
pub occur: Occur,
144144
/// Which options it aliases
145-
pub aliases: Vec<Opt> ,
145+
pub aliases: Vec<Opt>,
146146
}
147147

148148
/// One group of options, e.g., both -h and --help, along with
149149
/// their shared description and properties.
150-
#[deriving(Clone, PartialEq)]
150+
#[deriving(Clone, PartialEq, Eq)]
151151
pub struct OptGroup {
152152
/// Short Name of the `OptGroup`
153153
pub short_name: String,
@@ -164,28 +164,28 @@ pub struct OptGroup {
164164
}
165165

166166
/// Describes whether an option is given at all or has a value.
167-
#[deriving(Clone, PartialEq)]
167+
#[deriving(Clone, PartialEq, Eq)]
168168
enum Optval {
169169
Val(String),
170170
Given,
171171
}
172172

173173
/// The result of checking command line arguments. Contains a vector
174174
/// of matches and a vector of free strings.
175-
#[deriving(Clone, PartialEq)]
175+
#[deriving(Clone, PartialEq, Eq)]
176176
pub struct Matches {
177177
/// Options that matched
178-
opts: Vec<Opt> ,
178+
opts: Vec<Opt>,
179179
/// Values of the Options that matched
180-
vals: Vec<Vec<Optval> > ,
180+
vals: Vec<Vec<Optval>>,
181181
/// Free string fragments
182182
pub free: Vec<String>,
183183
}
184184

185185
/// The type returned when the command line does not conform to the
186186
/// expected format. Use the `Show` implementation to output detailed
187187
/// information.
188-
#[deriving(Clone, PartialEq)]
188+
#[deriving(Clone, PartialEq, Eq)]
189189
pub enum Fail_ {
190190
/// The option requires an argument but none was passed.
191191
ArgumentMissing(String),
@@ -200,7 +200,7 @@ pub enum Fail_ {
200200
}
201201

202202
/// The type of failure that occurred.
203-
#[deriving(PartialEq)]
203+
#[deriving(PartialEq, Eq)]
204204
#[allow(missing_doc)]
205205
pub enum FailType {
206206
ArgumentMissing_,

0 commit comments

Comments
 (0)