diff --git a/src/builder/value_parser.rs b/src/builder/value_parser.rs index 2649f8ab..877fd8f8 100644 --- a/src/builder/value_parser.rs +++ b/src/builder/value_parser.rs @@ -688,12 +688,15 @@ pub mod via_prelude { /// # Example /// /// ```rust +/// // Built-in types /// let parser = clap::value_parser!(String); /// assert_eq!(format!("{:?}", parser), "ValueParser::string"); /// let parser = clap::value_parser!(std::ffi::OsString); /// assert_eq!(format!("{:?}", parser), "ValueParser::os_string"); /// let parser = clap::value_parser!(std::path::PathBuf); /// assert_eq!(format!("{:?}", parser), "ValueParser::path_buf"); +/// +/// // FromStr types /// let parser = clap::value_parser!(usize); /// assert_eq!(format!("{:?}", parser), "ValueParser::other(usize)"); /// ``` @@ -707,24 +710,29 @@ macro_rules! value_parser { } mod private { + use super::*; + pub trait AnyValueParserSealed {} impl AnyValueParserSealed for P where T: std::any::Any + Send + Sync + 'static, - P: super::TypedValueParser, + P: TypedValueParser, { } + pub trait ValueParserViaSelfSealed {} + impl> ValueParserViaSelfSealed for &&&AutoValueParser

{} + pub trait ValueParserViaBuiltInSealed {} - impl ValueParserViaBuiltInSealed for &&super::AutoValueParser {} - impl ValueParserViaBuiltInSealed for &&super::AutoValueParser {} - impl ValueParserViaBuiltInSealed for &&super::AutoValueParser {} + impl ValueParserViaBuiltInSealed for &&AutoValueParser {} + impl ValueParserViaBuiltInSealed for &&AutoValueParser {} + impl ValueParserViaBuiltInSealed for &&AutoValueParser {} pub trait ValueParserViaArgEnumSealed {} - impl ValueParserViaArgEnumSealed for &super::AutoValueParser {} + impl ValueParserViaArgEnumSealed for &AutoValueParser {} pub trait ValueParserViaFromStrSealed {} - impl ValueParserViaFromStrSealed for super::AutoValueParser + impl ValueParserViaFromStrSealed for AutoValueParser where FromStr: std::str::FromStr + std::any::Any + Send + Sync + 'static, ::Err: