std.optparse.Error
class pub enum Error
A type that describes a parsing error.
Constructors
InvalidOption
InvalidOption(String)
The given option isn't recognized.
DuplicateOption
DuplicateOption(String)
The given option is recognized, but occurs more times than is expected.
MissingValue
MissingValue(String)
The given option is missing a value.
UnexpectedValue
UnexpectedValue(String)
A value is passed to the given option, but the option doesn't accept any values.
Instance methods
!=
Show source codeHide source code
fn pub !=(other: T) -> Bool {
(self == other).false?
}
fn pub !=(other: T) -> Bool
Returns true
if self
and the given object are not equal to each other.
==
Show source codeHide source code
fn pub ==(other: ref Error) -> Bool {
match (self, other) {
case (InvalidOption(a), InvalidOption(b)) -> a == b
case (DuplicateOption(a), DuplicateOption(b)) -> a == b
case (MissingValue(a), MissingValue(b)) -> a == b
case (UnexpectedValue(a), UnexpectedValue(b)) -> a == b
case _ -> false
}
}
fn pub ==(other: ref Error) -> Bool
Returns true
if self
and the given object are equal to each other.
This operator is used to perform structural equality. This means two objects residing in different memory locations may be considered equal, provided their structure is equal. For example, two different arrays may be considered to have structural equality if they contain the exact same values.
fmt
Show source codeHide source code
fn pub fmt(formatter: mut Formatter) {
match self {
case InvalidOption(v) -> formatter.tuple('InvalidOption').field(v).finish
case DuplicateOption(v) -> {
formatter.tuple('DuplicateOption').field(v).finish
}
case MissingValue(v) -> formatter.tuple('MissingValue').field(v).finish
case UnexpectedValue(v) -> {
formatter.tuple('UnexpectedValue').field(v).finish
}
}
}
fn pub fmt(formatter: mut Formatter)
Formats self
in a human-readable format for debugging purposes.
to_string
Show source codeHide source code
fn pub to_string -> String {
match self {
case InvalidOption(name) -> "the option '${name}' is unrecognized"
case DuplicateOption(name) -> "the option '${name}' is already specified"
case MissingValue(name) -> "the option '${name}' requires an argument"
case UnexpectedValue(name) -> {
"the option '${name}' doesn't accept any arguments"
}
}
}
fn pub to_string -> String
Converts self
to a String
.
Implemented traits
Equal
impl Equal[ref Error] for Error
Format
impl Format for Error
ToString
impl ToString for Error