mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
docs: makes all publicly available types viewable in docs
Some types weren't viewable in the docs, such as `Values`, `OsValues`, and `ArgSettings`. All these types should now be browsable in the docs page. Relates to #505
This commit is contained in:
parent
0c6c4ad743
commit
52ca6505b4
4 changed files with 32 additions and 3 deletions
|
@ -506,6 +506,19 @@ impl<'a> ArgMatches<'a> {
|
||||||
// commit: be5e1fa3c26e351761b33010ddbdaf5f05dbcc33
|
// commit: be5e1fa3c26e351761b33010ddbdaf5f05dbcc33
|
||||||
// license: MIT - Copyright (c) 2015 The Rust Project Developers
|
// license: MIT - Copyright (c) 2015 The Rust Project Developers
|
||||||
|
|
||||||
|
/// An iterator for getting multiple values out of an argument via the `Arg::values_of` method.
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// # use clap::{App, Arg};
|
||||||
|
/// let m = App::new("myapp")
|
||||||
|
/// .arg(Arg::with_name("output")
|
||||||
|
/// .takes_value(true))
|
||||||
|
/// .get_matches_from(vec!["myapp", "something"]);
|
||||||
|
///
|
||||||
|
/// assert_eq!(m.value_of("output"), Some("something"));
|
||||||
|
/// ```
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
#[allow(missing_debug_implementations)]
|
#[allow(missing_debug_implementations)]
|
||||||
pub struct Values<'a> {
|
pub struct Values<'a> {
|
||||||
|
@ -576,6 +589,23 @@ impl<'a, V> DoubleEndedIterator for Iter<'a, V> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// An iterator for getting multiple values out of an argument via the `Arg::values_of_os` method.
|
||||||
|
/// Usage of this iterator allows values which contain invalid UTF-8 code points unlike `Values`.
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```ignore
|
||||||
|
/// # use clap::{App, Arg};
|
||||||
|
/// use std::ffi::OsString;
|
||||||
|
/// use std::os::unix::ffi::OsStrExt;
|
||||||
|
///
|
||||||
|
/// let m = App::new("utf8")
|
||||||
|
/// .arg(Arg::from_usage("<arg> 'some arg'"))
|
||||||
|
/// .get_matches_from(vec![OsString::from("myprog"),
|
||||||
|
/// // "Hi {0xe9}!"
|
||||||
|
/// OsString::from_vec(vec![b'H', b'i', b' ', 0xe9, b'!'])]);
|
||||||
|
/// assert_eq!(&*m.value_of_os("arg").unwrap().as_bytes(), [b'H', b'i', b' ', 0xe9, b'!']);
|
||||||
|
/// ```
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
#[allow(missing_debug_implementations)]
|
#[allow(missing_debug_implementations)]
|
||||||
pub struct OsValues<'a> {
|
pub struct OsValues<'a> {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
pub use self::arg::Arg;
|
pub use self::arg::Arg;
|
||||||
pub use self::arg_matches::ArgMatches;
|
pub use self::arg_matches::{Values, OsValues, ArgMatches};
|
||||||
pub use self::arg_matcher::ArgMatcher;
|
pub use self::arg_matcher::ArgMatcher;
|
||||||
pub use self::subcommand::SubCommand;
|
pub use self::subcommand::SubCommand;
|
||||||
pub use self::arg_builder::{FlagBuilder, OptBuilder, PosBuilder};
|
pub use self::arg_builder::{FlagBuilder, OptBuilder, PosBuilder};
|
||||||
|
|
|
@ -46,7 +46,6 @@ impl Default for ArgFlags {
|
||||||
/// Various settings that apply to arguments and may be set, unset, and checked via getter/setter
|
/// Various settings that apply to arguments and may be set, unset, and checked via getter/setter
|
||||||
/// methods `Arg::set`, `Arg::unset`, and `Arg::is_set`
|
/// methods `Arg::set`, `Arg::unset`, and `Arg::is_set`
|
||||||
#[derive(Debug, PartialEq, Copy, Clone)]
|
#[derive(Debug, PartialEq, Copy, Clone)]
|
||||||
#[doc(hidden)]
|
|
||||||
pub enum ArgSettings {
|
pub enum ArgSettings {
|
||||||
/// The argument must be used
|
/// The argument must be used
|
||||||
Required,
|
Required,
|
||||||
|
|
|
@ -417,7 +417,7 @@ extern crate vec_map;
|
||||||
|
|
||||||
#[cfg(feature = "yaml")]
|
#[cfg(feature = "yaml")]
|
||||||
pub use yaml_rust::YamlLoader;
|
pub use yaml_rust::YamlLoader;
|
||||||
pub use args::{Arg, ArgGroup, ArgMatches, ArgSettings, SubCommand};
|
pub use args::{Arg, ArgGroup, ArgMatches, ArgSettings, SubCommand, Values, OsValues};
|
||||||
pub use app::{App, AppSettings};
|
pub use app::{App, AppSettings};
|
||||||
pub use fmt::Format;
|
pub use fmt::Format;
|
||||||
pub use errors::{Error, ErrorKind, Result};
|
pub use errors::{Error, ErrorKind, Result};
|
||||||
|
|
Loading…
Reference in a new issue