**This requires enabling the [`derive` feature flag][crate::_features].** Help: ```console $ typed-derive --help Usage: typed-derive[EXE] [OPTIONS] Options: -O Implicitly using `std::str::FromStr` -I Allow invalid UTF-8 paths --bind Handle IP addresses --sleep Allow human-readable durations -D Hand-written parser for tuples --port Support for discrete numbers [default: 22] [possible values: 22, 80] --log-level Support enums from a foreign crate that don't implement `ValueEnum` [default: info] [possible values: info, debug, info, warn, error] -h, --help Print help information ``` Optimization-level (number) ```console $ typed-derive -O 1 Args { optimization: Some(1), include: None, bind: None, sleep: None, defines: [], port: 22, log_level: Info } $ typed-derive -O plaid ? failed error: Invalid value 'plaid' for '-O ': invalid digit found in string For more information try '--help' ``` Include (path) ```console $ typed-derive -I../hello Args { optimization: None, include: Some("../hello"), bind: None, sleep: None, defines: [], port: 22, log_level: Info } ``` IP Address ```console $ typed-derive --bind 192.0.0.1 Args { optimization: None, include: None, bind: Some(192.0.0.1), sleep: None, defines: [], port: 22, log_level: Info } $ typed-derive --bind localhost ? failed error: Invalid value 'localhost' for '--bind ': invalid IP address syntax For more information try '--help' ``` Time ```console $ typed-derive --sleep 10s Args { optimization: None, include: None, bind: None, sleep: Some(Duration(10s)), defines: [], port: 22, log_level: Info } $ typed-derive --sleep forever ? failed error: Invalid value 'forever' for '--sleep ': expected number at 0 For more information try '--help' ``` Defines (key-value pairs) ```console $ typed-derive -D Foo=10 -D Alice=30 Args { optimization: None, include: None, bind: None, sleep: None, defines: [("Foo", 10), ("Alice", 30)], port: 22, log_level: Info } $ typed-derive -D Foo ? failed error: Invalid value 'Foo' for '-D ': invalid KEY=value: no `=` found in `Foo` For more information try '--help' $ typed-derive -D Foo=Bar ? failed error: Invalid value 'Foo=Bar' for '-D ': invalid digit found in string For more information try '--help' ``` Discrete numbers ```console $ typed-derive --port 22 Args { optimization: None, include: None, bind: None, sleep: None, defines: [], port: 22, log_level: Info } $ typed-derive --port 80 Args { optimization: None, include: None, bind: None, sleep: None, defines: [], port: 80, log_level: Info } $ typed-derive --port ? failed error: The argument '--port ' requires a value but none was supplied [possible values: 22, 80] For more information try '--help' $ typed-derive --port 3000 ? failed error: '3000' isn't a valid value for '--port ' [possible values: 22, 80] For more information try '--help' ``` Enums from crates that can't implement `ValueEnum` ```console $ typed-derive --log-level debug Args { optimization: None, include: None, bind: None, sleep: None, defines: [], port: 22, log_level: Debug } $ typed-derive --log-level error Args { optimization: None, include: None, bind: None, sleep: None, defines: [], port: 22, log_level: Error } $ typed-derive --log-level ? failed error: The argument '--log-level ' requires a value but none was supplied [possible values: info, debug, info, warn, error] For more information try '--help' $ typed-derive --log-level critical ? failed error: 'critical' isn't a valid value for '--log-level ' [possible values: info, debug, info, warn, error] For more information try '--help' ```