| Crates.io | parse_arg |
| lib.rs | parse_arg |
| version | 1.0.1 |
| created_at | 2018-11-05 17:53:00.819535+00 |
| updated_at | 2025-04-22 18:39:02.368364+00 |
| description | Traits and implementations for parsing command-line arguments. |
| homepage | |
| repository | https://github.com/Kixunil/parse_arg |
| max_upload_size | |
| id | 94877 |
| size | 28,993 |
Traits and implementations for parsing command-line arguments.
This crate provides traits to bridge various libraries providing parsable types with libraries
providing command line parsing implementations.
The core of the crate is ParseArg trait. It works much like FromStr trait, but with
these differences:
&OsStr instead of &str, thus allowing wider range of possible inputs.parse_owned_arg() method which can be specialized to avoid allocations.describe_type() to print human-readable description.
of expected input.Display in order to enable user-friendly interface.Further, the crate provides ParseArgFromStr trait, which causes any type implementing it to
auto-implement ParseArg trait. This is handy when implementing ParseArg for types that
already have FromStr implemented, so that boilerplate is reduced.
Any libraries that wish to help their consumers implement parsing their types from command line
may add this crate as an optional dependency and implement the ParseArg trait (directly or
indirectly) for their types.
Any binaries wishing to use these traits should enable the parse_arg feature of the
librariess that use this crate and use a CLI parses implementation crate that uses it too.
Currently the only known implementation is configure_me which
is also capable of parsing configuration files.
This crate is considered done. There shouldn't be any updates to it required, so there probably won't be any changes from now. I will accept PRs that fix problems but I don't expect to actively search for things to improve. The crate has only two traits and one enum, so this should be completely fine to use even if it becomes old.
The minimum supported Rust version of the crate is 1.63 and will always be whichever Rust version the current Debian stable (12 - Bookworm at the time of writing) supports.
MITNFA