mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 14:54:15 +00:00
docs(clap): fix typo core->std
This commit is contained in:
parent
77fdd5ffa7
commit
1a192521b6
3 changed files with 5 additions and 5 deletions
|
@ -45,7 +45,7 @@ Below are a few of the features which `clap` supports, full descriptions and usa
|
|||
* **Specific Value Sets**: Positional or Option Arguments can optionally define a specific set of allowed values (i.e. imagine a `--mode` option which may *only* have one of two values `fast` or `slow` such as `--mode fast` or `--mode slow`)
|
||||
* **Default Values**: Although not specifically provided by `clap` you can achieve this exact functionality from Rust's `Option<&str>.unwrap_or("some default")` method (or `Result<T,String>.unwrap_or(T)` when using typed values)
|
||||
* **Automatic Version from Cargo.toml**: `clap` is fully compatible with Rust's `env!()` macro for automatically setting the version of your application to the version in your Cargo.toml. See `examples/09_AutoVersion.rs` for how to do this (Thanks to [jhelwig](https://github.com/jhelwig) for pointing this out)
|
||||
* **Typed Values**: You can use several convenience macros provided by `clap` to get typed values (i.e. `i32`, `u8`, etc.) from positional or option arguments so long as the type you request implements `core::str::FromStr` See the `examples/12_TypedValues.rs` or the [documentation](http://kbknapp.github.io/clap-rs/docs/clap/index.html) for more information.
|
||||
* **Typed Values**: You can use several convenience macros provided by `clap` to get typed values (i.e. `i32`, `u8`, etc.) from positional or option arguments so long as the type you request implements `std::str::FromStr` See the `examples/12_TypedValues.rs` or the [documentation](http://kbknapp.github.io/clap-rs/docs/clap/index.html) for more information.
|
||||
|
||||
## Quick Example
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ use clap::App;
|
|||
|
||||
fn main() {
|
||||
// You can use some convenience macros provided by clap to get typed values, so long as the
|
||||
// type you specify implements core::str::FromStr
|
||||
// type you specify implements std::str::FromStr
|
||||
//
|
||||
// This works for both single, and multiple values (multiple values returns a Vec<T>)
|
||||
//
|
||||
|
|
|
@ -29,7 +29,7 @@ macro_rules! for_match {
|
|||
};
|
||||
}
|
||||
|
||||
/// Convenience macro getting a typed value `T` where `T` implements `std::fmt::FrmStr`
|
||||
/// Convenience macro getting a typed value `T` where `T` implements `std::str::FromStr`
|
||||
/// This macro returns a `Result<T,String>` which allows you as the developer to decide
|
||||
/// what you'd like to do on a failed parse. There are two types of errors, parse failures
|
||||
/// and those where the argument wasn't present (such as a non-required argument).
|
||||
|
@ -117,7 +117,7 @@ macro_rules! value_t {
|
|||
};
|
||||
}
|
||||
|
||||
/// Convenience macro getting a typed value `T` where `T` implements `std::fmt::FrmStr`
|
||||
/// Convenience macro getting a typed value `T` where `T` implements `std::str::FromStr`
|
||||
/// This macro returns a `T` or `Vec<T>` or exits with a usage string upon failure. This
|
||||
/// removes some of the boiler plate to handle failures from value_t! above.
|
||||
///
|
||||
|
@ -212,4 +212,4 @@ macro_rules! value_t_or_exit {
|
|||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue