Expand description
Command line argument paw-rser abstraction for main.
Paw’s goal is to show that C’s idea of passing arguments into main wasn’t that bad at all, but just needed a bit of oxidation to make it work with Rust.
Paw defines a trait, a proc macro, and an example implementation that when combined allow you to pass fully parsed arguments to main. Gone is the need to remember which methods to call in order to parse arguments in the CLI. Instead paw makes command line parsing feel first-class
§Examples
Create a parser from scratch
#[paw::main]
fn main(args: paw::Args) {
for arg in args {
println!("{:?}", arg);
}
}
To start the server do:
$ cargo run --example scratch -- localhost 8080
More Examples
Structs§
- Args
- An iterator over the arguments of a process, yielding an
String
value for each argument. - ArgsOs
- An iterator over the arguments of a process, yielding an
OsString
value for each argument.
Traits§
- Parse
Args - Allow a type to be parsed as arguments to main.