1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/// A single option.
///
/// For `Opt(x, y)`:
///   - `x` is `Some` character, or `None` if no option was found.
///   - `y` is `Some` string, or `None` if no argument was expected.
///
/// # Example
///
/// ```
/// # fn main() -> Result<(), Box<dyn std::error::Error>> {
/// use getopt::prelude::*;
///
/// // args = ["program", "-abc", "foo"];
/// # let args: Vec<String> = vec!["program", "-abc", "foo"]
/// #     .into_iter()
/// #     .map(String::from)
/// #     .collect();
/// let optstring = "ab:c";
/// let mut state = State::new();
///
/// assert_eq!(Opt(Some('a'), None), getopt(&args, optstring, &mut state)?);
/// assert_eq!(
///     Opt(Some('b'), Some("c".to_string())),
///     getopt(&args, optstring, &mut state)?
/// );
/// assert_eq!(Opt(None, None), getopt(&args, optstring, &mut state)?);
/// # Ok(())
/// # }
/// ```
#[derive(Debug, Eq, Ord, PartialEq, PartialOrd)]
pub struct Opt(pub Option<char>, pub Option<String>);