Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Type aware command line parsing in Rust
Rationale
While getopts is available for the Rust platform, it is not very practical, since the generated map of properties must be checked for existence, then cast to the required types, leading to a lot of options and pattern matching.
Usage
With this library, you can define a structure representing the possible parameters, deriving Decodable, and parse it directly:
extern crate getopts;
extern crate typedopts;
extern crate serialize;
use ;
use os;
use ;
If the decode function finds the correct arguments and is able to parse them, you will get an instance of the structure you need in the Result. Otherwise, you receive an enum of errors:
- UnimplementedDecoder: required but should not happen (if you find a use case where you encounter it, please open an issue)
- MissingField: the option was not found. If you use the reqopt function from getopts, it would warn you before typedopts
- ExpectedType: the option's value is not the one needed
Unless you want to handle the errors yourself, you can use directly the to__err__msg function.
Examples
Most types can be handled by the library, as long as they can derive from Decodable. Integers, Unsigned integers, floating point numbers, booleans, characters, strings are easy to do.
Enumerations will require that you define them as Decodable too:
/* ... */
if
Options are also supported:
/* ... */
match decoded.option