2024-03-11 07:31:05 +00:00
<!DOCTYPE html> < html lang = "en" > < head > < meta charset = "utf-8" > < meta name = "viewport" content = "width=device-width, initial-scale=1.0" > < meta name = "generator" content = "rustdoc" > < meta name = "description" content = "Parse/validate argument values" > < title > TypedValueParser in clap::builder - Rust< / title > < link rel = "preload" as = "font" type = "font/woff2" crossorigin href = "../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2" > < link rel = "preload" as = "font" type = "font/woff2" crossorigin href = "../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2" > < link rel = "preload" as = "font" type = "font/woff2" crossorigin href = "../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2" > < link rel = "preload" as = "font" type = "font/woff2" crossorigin href = "../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2" > < link rel = "preload" as = "font" type = "font/woff2" crossorigin href = "../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2" > < link rel = "stylesheet" href = "../../static.files/normalize-76eba96aa4d2e634.css" > < link rel = "stylesheet" href = "../../static.files/rustdoc-ac92e1bbe349e143.css" > < meta name = "rustdoc-vars" data-root-path = "../../" data-static-root-path = "../../static.files/" data-current-crate = "clap" data-themes = "" data-resource-suffix = "" data-rustdoc-version = "1.76.0 (07dca489a 2024-02-04)" data-channel = "1.76.0" data-search-js = "search-2b6ce74ff89ae146.js" data-settings-js = "settings-4313503d2e1961c2.js" > < script src = "../../static.files/storage-f2adc0d6ca4d09fb.js" > < / script > < script defer src = "sidebar-items.js" > < / script > < script defer src = "../../static.files/main-305769736d49e732.js" > < / script > < noscript > < link rel = "stylesheet" href = "../../static.files/noscript-feafe1bb7466e4bd.css" > < / noscript > < link rel = "alternate icon" type = "image/png" href = "../../static.files/favicon-16x16-8b506e7a72182f1c.png" > < link rel = "alternate icon" type = "image/png" href = "../../static.files/favicon-32x32-422f7d1d52889060.png" > < link rel = "icon" type = "image/svg+xml" href = "../../static.files/favicon-2c020d218678b618.svg" > < / head > < body class = "rustdoc trait" > <!-- [if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif] --> < nav class = "mobile-topbar" > < button class = "sidebar-menu-toggle" > ☰ < / button > < a class = "logo-container" href = "../../clap/index.html" > < img src = "https://raw.githubusercontent.com/clap-rs/clap/master/assets/clap.png" alt = "" > < / a > < / nav > < nav class = "sidebar" > < div class = "sidebar-crate" > < a class = "logo-container" href = "../../clap/index.html" > < img src = "https://raw.githubusercontent.com/clap-rs/clap/master/assets/clap.png" alt = "logo" > < / a > < h2 > < a href = "../../clap/index.html" > clap< / a > < span class = "version" > 4.5.2< / span > < / h2 > < / div > < h2 class = "location" > < a href = "#" > TypedValueParser< / a > < / h2 > < div class = "sidebar-elems" > < section > < h3 > < a href = "#required-associated-types" > Required Associated Types< / a > < / h3 > < ul class = "block" > < li > < a href = "#associatedtype.Value" > Value< / a > < / li > < / ul > < h3 > < a href = "#required-methods" > Required Methods< / a > < / h3 > < ul class = "block" > < li > < a href = "#tymethod.parse_ref" > parse_ref< / a > < / li > < / ul > < h3 > < a href = "#provided-methods" > Provided Methods< / a > < / h3 > < ul class = "block" > < li > < a href = "#method.map" > map< / a > < / li > < li > < a href = "#method.parse" > parse< / a > < / li > < li > < a href = "#method.parse_" > parse_< / a > < / li > < li > < a href = "#method.parse_ref_" > parse_ref_< / a > < / li > < li > < a href = "#method.possible_values" > possible_values< / a > < / li > < li > < a href = "#method.try_map" > try_map< / a > < / li > < / ul > < h3 > < a href = "#object-safety" > Object Safety< / a > < / h3 > < h3 > < a href = "#implementors" > Implementors< / a > < / h3 > < / section > < h2 > < a href = "index.html" > In clap::builder< / a > < / h2 > < / div > < / nav > < div class = "sidebar-resizer" > < / div >
2024-02-13 06:38:44 +00:00
< main > < div class = "width-limiter" > < nav class = "sub" > < form class = "search-form" > < span > < / span > < div id = "sidebar-button" tabindex = "-1" > < a href = "../../clap/all.html" title = "show sidebar" > < / a > < / div > < input class = "search-input" name = "search" aria-label = "Run search in the documentation" autocomplete = "off" spellcheck = "false" placeholder = "Click or press ‘ S’ to search, ‘ ?’ for more options…" type = "search" > < div id = "help-button" tabindex = "-1" > < a href = "../../help.html" title = "help" > ?< / a > < / div > < div id = "settings-menu" tabindex = "-1" > < a href = "../../settings.html" title = "settings" > < img width = "22" height = "22" alt = "Change settings" src = "../../static.files/wheel-7b819b6101059cd0.svg" > < / a > < / div > < / form > < / nav > < section id = "main-content" class = "content" > < div class = "main-heading" > < h1 > Trait < a href = "../index.html" > clap< / a > ::< wbr > < a href = "index.html" > builder< / a > ::< wbr > < a class = "trait" href = "#" > TypedValueParser< / a > < button id = "copy-path" title = "Copy item path to clipboard" > < img src = "../../static.files/clipboard-7571035ce49a181d.svg" width = "19" height = "18" alt = "Copy item path" > < / button > < / h1 > < span class = "out-of-band" > < a class = "src" href = "../../src/clap_builder/builder/value_parser.rs.html#749" > source< / a > · < button id = "toggle-all-docs" title = "collapse all docs" > [< span > − < / span > ]< / button > < / span > < / div > < pre class = "rust item-decl" > < code > pub trait TypedValueParser: < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title = "trait core::clone::Clone" > Clone< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title = "trait core::marker::Send" > Send< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title = "trait core::marker::Sync" > Sync< / a > + 'static {
type < a href = "#associatedtype.Value" class = "associatedtype" > Value< / a > : < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title = "trait core::marker::Send" > Send< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title = "trait core::marker::Sync" > Sync< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title = "trait core::clone::Clone" > Clone< / a > ;
// Required method
fn < a href = "#tymethod.parse_ref" class = "fn" > parse_ref< / a > (
& self,
cmd: & < a class = "struct" href = "../struct.Command.html" title = "struct clap::Command" > Command< / a > ,
arg: < a class = "enum" href = "https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title = "enum core::option::Option" > Option< / a > < & < a class = "struct" href = "../struct.Arg.html" title = "struct clap::Arg" > Arg< / a > > ,
value: & < a class = "struct" href = "https://doc.rust-lang.org/1.76.0/std/ffi/os_str/struct.OsStr.html" title = "struct std::ffi::os_str::OsStr" > OsStr< / a >
) -> < a class = "enum" href = "https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title = "enum core::result::Result" > Result< / a > < Self::< a class = "associatedtype" href = "trait.TypedValueParser.html#associatedtype.Value" title = "type clap::builder::TypedValueParser::Value" > Value< / a > , < a class = "struct" href = "../error/struct.Error.html" title = "struct clap::error::Error" > Error< / a > > ;
// Provided methods
fn < a href = "#method.parse_ref_" class = "fn" > parse_ref_< / a > (
& self,
cmd: & < a class = "struct" href = "../struct.Command.html" title = "struct clap::Command" > Command< / a > ,
arg: < a class = "enum" href = "https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title = "enum core::option::Option" > Option< / a > < & < a class = "struct" href = "../struct.Arg.html" title = "struct clap::Arg" > Arg< / a > > ,
value: & < a class = "struct" href = "https://doc.rust-lang.org/1.76.0/std/ffi/os_str/struct.OsStr.html" title = "struct std::ffi::os_str::OsStr" > OsStr< / a > ,
_source: < a class = "enum" href = "../parser/enum.ValueSource.html" title = "enum clap::parser::ValueSource" > ValueSource< / a >
) -> < a class = "enum" href = "https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title = "enum core::result::Result" > Result< / a > < Self::< a class = "associatedtype" href = "trait.TypedValueParser.html#associatedtype.Value" title = "type clap::builder::TypedValueParser::Value" > Value< / a > , < a class = "struct" href = "../error/struct.Error.html" title = "struct clap::error::Error" > Error< / a > > { ... }
< span class = "item-spacer" > < / span > fn < a href = "#method.parse" class = "fn" > parse< / a > (
& self,
cmd: & < a class = "struct" href = "../struct.Command.html" title = "struct clap::Command" > Command< / a > ,
arg: < a class = "enum" href = "https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title = "enum core::option::Option" > Option< / a > < & < a class = "struct" href = "../struct.Arg.html" title = "struct clap::Arg" > Arg< / a > > ,
value: < a class = "struct" href = "https://doc.rust-lang.org/1.76.0/std/ffi/os_str/struct.OsString.html" title = "struct std::ffi::os_str::OsString" > OsString< / a >
) -> < a class = "enum" href = "https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title = "enum core::result::Result" > Result< / a > < Self::< a class = "associatedtype" href = "trait.TypedValueParser.html#associatedtype.Value" title = "type clap::builder::TypedValueParser::Value" > Value< / a > , < a class = "struct" href = "../error/struct.Error.html" title = "struct clap::error::Error" > Error< / a > > { ... }
< span class = "item-spacer" > < / span > fn < a href = "#method.parse_" class = "fn" > parse_< / a > (
& self,
cmd: & < a class = "struct" href = "../struct.Command.html" title = "struct clap::Command" > Command< / a > ,
arg: < a class = "enum" href = "https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title = "enum core::option::Option" > Option< / a > < & < a class = "struct" href = "../struct.Arg.html" title = "struct clap::Arg" > Arg< / a > > ,
value: < a class = "struct" href = "https://doc.rust-lang.org/1.76.0/std/ffi/os_str/struct.OsString.html" title = "struct std::ffi::os_str::OsString" > OsString< / a > ,
_source: < a class = "enum" href = "../parser/enum.ValueSource.html" title = "enum clap::parser::ValueSource" > ValueSource< / a >
) -> < a class = "enum" href = "https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title = "enum core::result::Result" > Result< / a > < Self::< a class = "associatedtype" href = "trait.TypedValueParser.html#associatedtype.Value" title = "type clap::builder::TypedValueParser::Value" > Value< / a > , < a class = "struct" href = "../error/struct.Error.html" title = "struct clap::error::Error" > Error< / a > > { ... }
< span class = "item-spacer" > < / span > fn < a href = "#method.possible_values" class = "fn" > possible_values< / a > (
& self
) -> < a class = "enum" href = "https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title = "enum core::option::Option" > Option< / a > < < a class = "struct" href = "https://doc.rust-lang.org/1.76.0/alloc/boxed/struct.Box.html" title = "struct alloc::boxed::Box" > Box< / a > < dyn < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html" title = "trait core::iter::traits::iterator::Iterator" > Iterator< / a > < Item = < a class = "struct" href = "struct.PossibleValue.html" title = "struct clap::builder::PossibleValue" > PossibleValue< / a > > + '_> > { ... }
< span class = "item-spacer" > < / span > fn < a href = "#method.map" class = "fn" > map< / a > < T, F> (self, func: F) -> < a class = "struct" href = "struct.MapValueParser.html" title = "struct clap::builder::MapValueParser" > MapValueParser< / a > < Self, F>
< span class = "where" > where T: < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title = "trait core::marker::Send" > Send< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title = "trait core::marker::Sync" > Sync< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title = "trait core::clone::Clone" > Clone< / a > ,
F: < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/ops/function/trait.Fn.html" title = "trait core::ops::function::Fn" > Fn< / a > (Self::< a class = "associatedtype" href = "trait.TypedValueParser.html#associatedtype.Value" title = "type clap::builder::TypedValueParser::Value" > Value< / a > ) -> T + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title = "trait core::clone::Clone" > Clone< / a > < / span > { ... }
< span class = "item-spacer" > < / span > fn < a href = "#method.try_map" class = "fn" > try_map< / a > < T, E, F> (self, func: F) -> < a class = "struct" href = "struct.TryMapValueParser.html" title = "struct clap::builder::TryMapValueParser" > TryMapValueParser< / a > < Self, F>
< span class = "where" > where F: < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/ops/function/trait.Fn.html" title = "trait core::ops::function::Fn" > Fn< / a > (Self::< a class = "associatedtype" href = "trait.TypedValueParser.html#associatedtype.Value" title = "type clap::builder::TypedValueParser::Value" > Value< / a > ) -> < a class = "enum" href = "https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title = "enum core::result::Result" > Result< / a > < T, E> + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title = "trait core::clone::Clone" > Clone< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title = "trait core::marker::Send" > Send< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title = "trait core::marker::Sync" > Sync< / a > + 'static,
T: < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title = "trait core::marker::Send" > Send< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title = "trait core::marker::Sync" > Sync< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title = "trait core::clone::Clone" > Clone< / a > ,
E: < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html" title = "trait core::convert::Into" > Into< / a > < < a class = "struct" href = "https://doc.rust-lang.org/1.76.0/alloc/boxed/struct.Box.html" title = "struct alloc::boxed::Box" > Box< / a > < dyn < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/error/trait.Error.html" title = "trait core::error::Error" > Error< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title = "trait core::marker::Send" > Send< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title = "trait core::marker::Sync" > Sync< / a > > > < / span > { ... }
}< / code > < / pre > < details class = "toggle top-doc" open > < summary class = "hideme" > < span > Expand description< / span > < / summary > < div class = "docblock" > < p > Parse/validate argument values< / p >
< p > As alternatives to implementing < code > TypedValueParser< / code > ,< / p >
< ul >
< li > Use < code > Fn(& str) -> Result< T, E> < / code > which implements < code > TypedValueParser< / code > < / li >
< li > < a href = "trait.TypedValueParser.html#method.map" title = "method clap::builder::TypedValueParser::map" > < code > TypedValueParser::map< / code > < / a > or < a href = "trait.TypedValueParser.html#method.try_map" title = "method clap::builder::TypedValueParser::try_map" > < code > TypedValueParser::try_map< / code > < / a > to adapt an existing < code > TypedValueParser< / code > < / li >
< / ul >
< p > See < code > ValueParserFactory< / code > to register < code > TypedValueParser::Value< / code > with
< a href = "../macro.value_parser.html" title = "macro clap::value_parser" > < code > value_parser!< / code > < / a > .< / p >
< h2 id = "example" > < a href = "#example" > Example< / a > < / h2 >
< div class = "example-wrap" > < pre class = "rust rust-example-rendered" > < code > < span class = "attr" > #[derive(Clone)]
< / span > < span class = "kw" > struct < / span > Custom(u32);
< span class = "attr" > #[derive(Clone)]
< / span > < span class = "kw" > struct < / span > CustomValueParser;
< span class = "kw" > impl < / span > clap::builder::TypedValueParser < span class = "kw" > for < / span > CustomValueParser {
< span class = "kw" > type < / span > Value = Custom;
< span class = "kw" > fn < / span > parse_ref(
< span class = "kw-2" > & < / span > < span class = "self" > self< / span > ,
cmd: < span class = "kw-2" > & < / span > clap::Command,
arg: < span class = "prelude-ty" > Option< / span > < < span class = "kw-2" > & < / span > clap::Arg> ,
value: < span class = "kw-2" > & < / span > std::ffi::OsStr,
) -> < span class = "prelude-ty" > Result< / span > < < span class = "self" > Self< / span > ::Value, clap::Error> {
< span class = "kw" > let < / span > inner = < span class = "macro" > clap::value_parser!< / span > (u32);
< span class = "kw" > let < / span > val = inner.parse_ref(cmd, arg, value)< span class = "question-mark" > ?< / span > ;
< span class = "kw" > const < / span > INVALID_VALUE: u32 = < span class = "number" > 10< / span > ;
< span class = "kw" > if < / span > val == INVALID_VALUE {
< span class = "kw" > let < / span > < span class = "kw-2" > mut < / span > err = clap::Error::new(ErrorKind::ValueValidation)
.with_cmd(cmd);
< span class = "kw" > if let < / span > < span class = "prelude-val" > Some< / span > (arg) = arg {
err.insert(ContextKind::InvalidArg, ContextValue::String(arg.to_string()));
}
err.insert(ContextKind::InvalidValue, ContextValue::String(INVALID_VALUE.to_string()));
< span class = "kw" > return < / span > < span class = "prelude-val" > Err< / span > (err);
}
< span class = "prelude-val" > Ok< / span > (Custom(val))
}
}< / code > < / pre > < / div >
< / div > < / details > < h2 id = "required-associated-types" class = "section-header" > Required Associated Types< a href = "#required-associated-types" class = "anchor" > §< / a > < / h2 > < div class = "methods" > < details class = "toggle" open > < summary > < section id = "associatedtype.Value" class = "method" > < a class = "src rightside" href = "../../src/clap_builder/builder/value_parser.rs.html#751" > source< / a > < h4 class = "code-header" > type < a href = "#associatedtype.Value" class = "associatedtype" > Value< / a > : < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title = "trait core::marker::Send" > Send< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title = "trait core::marker::Sync" > Sync< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title = "trait core::clone::Clone" > Clone< / a > < / h4 > < / section > < / summary > < div class = "docblock" > < p > Argument’ s value type< / p >
< / div > < / details > < / div > < h2 id = "required-methods" class = "section-header" > Required Methods< a href = "#required-methods" class = "anchor" > §< / a > < / h2 > < div class = "methods" > < details class = "toggle method-toggle" open > < summary > < section id = "tymethod.parse_ref" class = "method" > < a class = "src rightside" href = "../../src/clap_builder/builder/value_parser.rs.html#756-761" > source< / a > < h4 class = "code-header" > fn < a href = "#tymethod.parse_ref" class = "fn" > parse_ref< / a > (
& self,
cmd: & < a class = "struct" href = "../struct.Command.html" title = "struct clap::Command" > Command< / a > ,
arg: < a class = "enum" href = "https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title = "enum core::option::Option" > Option< / a > < & < a class = "struct" href = "../struct.Arg.html" title = "struct clap::Arg" > Arg< / a > > ,
value: & < a class = "struct" href = "https://doc.rust-lang.org/1.76.0/std/ffi/os_str/struct.OsStr.html" title = "struct std::ffi::os_str::OsStr" > OsStr< / a >
) -> < a class = "enum" href = "https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title = "enum core::result::Result" > Result< / a > < Self::< a class = "associatedtype" href = "trait.TypedValueParser.html#associatedtype.Value" title = "type clap::builder::TypedValueParser::Value" > Value< / a > , < a class = "struct" href = "../error/struct.Error.html" title = "struct clap::error::Error" > Error< / a > > < / h4 > < / section > < / summary > < div class = "docblock" > < p > Parse the argument value< / p >
< p > When < code > arg< / code > is < code > None< / code > , an external subcommand value is being parsed.< / p >
< / div > < / details > < / div > < h2 id = "provided-methods" class = "section-header" > Provided Methods< a href = "#provided-methods" class = "anchor" > §< / a > < / h2 > < div class = "methods" > < details class = "toggle method-toggle" open > < summary > < section id = "method.parse_ref_" class = "method" > < a class = "src rightside" href = "../../src/clap_builder/builder/value_parser.rs.html#766-772" > source< / a > < h4 class = "code-header" > fn < a href = "#method.parse_ref_" class = "fn" > parse_ref_< / a > (
& self,
cmd: & < a class = "struct" href = "../struct.Command.html" title = "struct clap::Command" > Command< / a > ,
arg: < a class = "enum" href = "https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title = "enum core::option::Option" > Option< / a > < & < a class = "struct" href = "../struct.Arg.html" title = "struct clap::Arg" > Arg< / a > > ,
value: & < a class = "struct" href = "https://doc.rust-lang.org/1.76.0/std/ffi/os_str/struct.OsStr.html" title = "struct std::ffi::os_str::OsStr" > OsStr< / a > ,
_source: < a class = "enum" href = "../parser/enum.ValueSource.html" title = "enum clap::parser::ValueSource" > ValueSource< / a >
) -> < a class = "enum" href = "https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title = "enum core::result::Result" > Result< / a > < Self::< a class = "associatedtype" href = "trait.TypedValueParser.html#associatedtype.Value" title = "type clap::builder::TypedValueParser::Value" > Value< / a > , < a class = "struct" href = "../error/struct.Error.html" title = "struct clap::error::Error" > Error< / a > > < / h4 > < / section > < / summary > < div class = "docblock" > < p > Parse the argument value< / p >
< p > When < code > arg< / code > is < code > None< / code > , an external subcommand value is being parsed.< / p >
< / div > < / details > < details class = "toggle method-toggle" open > < summary > < section id = "method.parse" class = "method" > < a class = "src rightside" href = "../../src/clap_builder/builder/value_parser.rs.html#779-784" > source< / a > < h4 class = "code-header" > fn < a href = "#method.parse" class = "fn" > parse< / a > (
& self,
cmd: & < a class = "struct" href = "../struct.Command.html" title = "struct clap::Command" > Command< / a > ,
arg: < a class = "enum" href = "https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title = "enum core::option::Option" > Option< / a > < & < a class = "struct" href = "../struct.Arg.html" title = "struct clap::Arg" > Arg< / a > > ,
value: < a class = "struct" href = "https://doc.rust-lang.org/1.76.0/std/ffi/os_str/struct.OsString.html" title = "struct std::ffi::os_str::OsString" > OsString< / a >
) -> < a class = "enum" href = "https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title = "enum core::result::Result" > Result< / a > < Self::< a class = "associatedtype" href = "trait.TypedValueParser.html#associatedtype.Value" title = "type clap::builder::TypedValueParser::Value" > Value< / a > , < a class = "struct" href = "../error/struct.Error.html" title = "struct clap::error::Error" > Error< / a > > < / h4 > < / section > < / summary > < div class = "docblock" > < p > Parse the argument value< / p >
< p > When < code > arg< / code > is < code > None< / code > , an external subcommand value is being parsed.< / p >
< / div > < / details > < details class = "toggle method-toggle" open > < summary > < section id = "method.parse_" class = "method" > < a class = "src rightside" href = "../../src/clap_builder/builder/value_parser.rs.html#791-797" > source< / a > < h4 class = "code-header" > fn < a href = "#method.parse_" class = "fn" > parse_< / a > (
& self,
cmd: & < a class = "struct" href = "../struct.Command.html" title = "struct clap::Command" > Command< / a > ,
arg: < a class = "enum" href = "https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title = "enum core::option::Option" > Option< / a > < & < a class = "struct" href = "../struct.Arg.html" title = "struct clap::Arg" > Arg< / a > > ,
value: < a class = "struct" href = "https://doc.rust-lang.org/1.76.0/std/ffi/os_str/struct.OsString.html" title = "struct std::ffi::os_str::OsString" > OsString< / a > ,
_source: < a class = "enum" href = "../parser/enum.ValueSource.html" title = "enum clap::parser::ValueSource" > ValueSource< / a >
) -> < a class = "enum" href = "https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title = "enum core::result::Result" > Result< / a > < Self::< a class = "associatedtype" href = "trait.TypedValueParser.html#associatedtype.Value" title = "type clap::builder::TypedValueParser::Value" > Value< / a > , < a class = "struct" href = "../error/struct.Error.html" title = "struct clap::error::Error" > Error< / a > > < / h4 > < / section > < / summary > < div class = "docblock" > < p > Parse the argument value< / p >
< p > When < code > arg< / code > is < code > None< / code > , an external subcommand value is being parsed.< / p >
< / div > < / details > < details class = "toggle method-toggle" open > < summary > < section id = "method.possible_values" class = "method" > < a class = "src rightside" href = "../../src/clap_builder/builder/value_parser.rs.html#805-807" > source< / a > < h4 class = "code-header" > fn < a href = "#method.possible_values" class = "fn" > possible_values< / a > (
& self
) -> < a class = "enum" href = "https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title = "enum core::option::Option" > Option< / a > < < a class = "struct" href = "https://doc.rust-lang.org/1.76.0/alloc/boxed/struct.Box.html" title = "struct alloc::boxed::Box" > Box< / a > < dyn < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html" title = "trait core::iter::traits::iterator::Iterator" > Iterator< / a > < Item = < a class = "struct" href = "struct.PossibleValue.html" title = "struct clap::builder::PossibleValue" > PossibleValue< / a > > + '_> > < / h4 > < / section > < / summary > < div class = "docblock" > < p > Reflect on enumerated value properties< / p >
< p > Error checking should not be done with this; it is mostly targeted at user-facing
applications like errors and completion.< / p >
< / div > < / details > < details class = "toggle method-toggle" open > < summary > < section id = "method.map" class = "method" > < a class = "src rightside" href = "../../src/clap_builder/builder/value_parser.rs.html#848-851" > source< / a > < h4 class = "code-header" > fn < a href = "#method.map" class = "fn" > map< / a > < T, F> (self, func: F) -> < a class = "struct" href = "struct.MapValueParser.html" title = "struct clap::builder::MapValueParser" > MapValueParser< / a > < Self, F> < div class = "where" > where
T: < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title = "trait core::marker::Send" > Send< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title = "trait core::marker::Sync" > Sync< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title = "trait core::clone::Clone" > Clone< / a > ,
F: < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/ops/function/trait.Fn.html" title = "trait core::ops::function::Fn" > Fn< / a > (Self::< a class = "associatedtype" href = "trait.TypedValueParser.html#associatedtype.Value" title = "type clap::builder::TypedValueParser::Value" > Value< / a > ) -> T + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title = "trait core::clone::Clone" > Clone< / a > ,< / div > < / h4 > < / section > < / summary > < div class = "docblock" > < p > Adapt a < code > TypedValueParser< / code > from one value to another< / p >
< h5 id = "example-1" > < a href = "#example-1" > Example< / a > < / h5 >
< div class = "example-wrap" > < pre class = "rust rust-example-rendered" > < code > < span class = "kw" > let < / span > cmd = Command::new(< span class = "string" > "mycmd"< / span > )
.arg(
Arg::new(< span class = "string" > "flag"< / span > )
.long(< span class = "string" > "flag"< / span > )
.action(clap::ArgAction::SetTrue)
.value_parser(
BoolishValueParser::new()
.map(|b| -> usize {
< span class = "kw" > if < / span > b { < span class = "number" > 10 < / span > } < span class = "kw" > else < / span > { < span class = "number" > 5 < / span > }
})
)
);
< span class = "kw" > let < / span > matches = cmd.clone().try_get_matches_from([< span class = "string" > "mycmd"< / span > , < span class = "string" > "--flag"< / span > ]).unwrap();
< span class = "macro" > assert!< / span > (matches.contains_id(< span class = "string" > "flag"< / span > ));
< span class = "macro" > assert_eq!< / span > (
matches.get_one::< usize> (< span class = "string" > "flag"< / span > ).copied(),
< span class = "prelude-val" > Some< / span > (< span class = "number" > 10< / span > )
);
< span class = "kw" > let < / span > matches = cmd.try_get_matches_from([< span class = "string" > "mycmd"< / span > ]).unwrap();
< span class = "macro" > assert!< / span > (matches.contains_id(< span class = "string" > "flag"< / span > ));
< span class = "macro" > assert_eq!< / span > (
matches.get_one::< usize> (< span class = "string" > "flag"< / span > ).copied(),
< span class = "prelude-val" > Some< / span > (< span class = "number" > 5< / span > )
);< / code > < / pre > < / div >
< / div > < / details > < details class = "toggle method-toggle" open > < summary > < section id = "method.try_map" class = "method" > < a class = "src rightside" href = "../../src/clap_builder/builder/value_parser.rs.html#898-902" > source< / a > < h4 class = "code-header" > fn < a href = "#method.try_map" class = "fn" > try_map< / a > < T, E, F> (self, func: F) -> < a class = "struct" href = "struct.TryMapValueParser.html" title = "struct clap::builder::TryMapValueParser" > TryMapValueParser< / a > < Self, F> < div class = "where" > where
F: < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/ops/function/trait.Fn.html" title = "trait core::ops::function::Fn" > Fn< / a > (Self::< a class = "associatedtype" href = "trait.TypedValueParser.html#associatedtype.Value" title = "type clap::builder::TypedValueParser::Value" > Value< / a > ) -> < a class = "enum" href = "https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title = "enum core::result::Result" > Result< / a > < T, E> + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title = "trait core::clone::Clone" > Clone< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title = "trait core::marker::Send" > Send< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title = "trait core::marker::Sync" > Sync< / a > + 'static,
T: < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title = "trait core::marker::Send" > Send< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title = "trait core::marker::Sync" > Sync< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title = "trait core::clone::Clone" > Clone< / a > ,
E: < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html" title = "trait core::convert::Into" > Into< / a > < < a class = "struct" href = "https://doc.rust-lang.org/1.76.0/alloc/boxed/struct.Box.html" title = "struct alloc::boxed::Box" > Box< / a > < dyn < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/error/trait.Error.html" title = "trait core::error::Error" > Error< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title = "trait core::marker::Send" > Send< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title = "trait core::marker::Sync" > Sync< / a > > > ,< / div > < / h4 > < / section > < / summary > < div class = "docblock" > < p > Adapt a < code > TypedValueParser< / code > from one value to another< / p >
< h5 id = "example-2" > < a href = "#example-2" > Example< / a > < / h5 >
< div class = "example-wrap" > < pre class = "rust rust-example-rendered" > < code > < span class = "kw" > let < / span > cmd = Command::new(< span class = "string" > "mycmd"< / span > )
.arg(
Arg::new(< span class = "string" > "flag"< / span > )
.long(< span class = "string" > "flag"< / span > )
.value_parser(
OsStringValueParser::new()
.try_map(verify_ext)
)
);
< span class = "kw" > fn < / span > verify_ext(os: OsString) -> < span class = "prelude-ty" > Result< / span > < PathBuf, < span class = "kw-2" > & < / span > < span class = "lifetime" > 'static < / span > str> {
< span class = "kw" > let < / span > path = PathBuf::from(os);
< span class = "kw" > if < / span > path.extension() != < span class = "prelude-val" > Some< / span > (OsStr::new(< span class = "string" > "rs"< / span > )) {
< span class = "kw" > return < / span > < span class = "prelude-val" > Err< / span > (< span class = "string" > "only Rust files are supported"< / span > );
}
< span class = "prelude-val" > Ok< / span > (path)
}
< span class = "kw" > let < / span > error = cmd.clone().try_get_matches_from([< span class = "string" > "mycmd"< / span > , < span class = "string" > "--flag"< / span > , < span class = "string" > "foo.txt"< / span > ]).unwrap_err();
error.print();
< span class = "kw" > let < / span > matches = cmd.try_get_matches_from([< span class = "string" > "mycmd"< / span > , < span class = "string" > "--flag"< / span > , < span class = "string" > "foo.rs"< / span > ]).unwrap();
< span class = "macro" > assert!< / span > (matches.contains_id(< span class = "string" > "flag"< / span > ));
< span class = "macro" > assert_eq!< / span > (
matches.get_one::< PathBuf> (< span class = "string" > "flag"< / span > ).map(|s| s.as_path()),
< span class = "prelude-val" > Some< / span > (Path::new(< span class = "string" > "foo.rs"< / span > ))
);< / code > < / pre > < / div >
< / div > < / details > < / div > < h2 id = "object-safety" class = "section-header" > Object Safety< a href = "#object-safety" class = "anchor" > §< / a > < / h2 > < div class = "object-safety-info" > This trait is < b > not< / b > < a href = "https://doc.rust-lang.org/1.76.0/reference/items/traits.html#object-safety" > object safe< / a > .< / div > < h2 id = "implementors" class = "section-header" > Implementors< a href = "#implementors" class = "anchor" > §< / a > < / h2 > < div id = "implementors-list" > < details class = "toggle implementors-toggle" > < summary > < section id = "impl-TypedValueParser-for-BoolValueParser" class = "impl" > < a class = "src rightside" href = "../../src/clap_builder/builder/value_parser.rs.html#1729" > source< / a > < a href = "#impl-TypedValueParser-for-BoolValueParser" class = "anchor" > §< / a > < h3 class = "code-header" > impl < a class = "trait" href = "trait.TypedValueParser.html" title = "trait clap::builder::TypedValueParser" > TypedValueParser< / a > for < a class = "struct" href = "struct.BoolValueParser.html" title = "struct clap::builder::BoolValueParser" > BoolValueParser< / a > < / h3 > < / section > < / summary > < div class = "impl-items" > < section id = "associatedtype.Value-1" class = "associatedtype trait-impl" > < a href = "#associatedtype.Value-1" class = "anchor" > §< / a > < h4 class = "code-header" > type < a href = "#associatedtype.Value" class = "associatedtype" > Value< / a > = < a class = "primitive" href = "https://doc.rust-lang.org/1.76.0/std/primitive.bool.html" > bool< / a > < / h4 > < / section > < / div > < / details > < details class = "toggle implementors-toggle" > < summary > < section id = "impl-TypedValueParser-for-BoolishValueParser" class = "impl" > < a class = "src rightside" href = "../../src/clap_builder/builder/value_parser.rs.html#1930" > source< / a > < a href = "#impl-TypedValueParser-for-BoolishValueParser" class = "anchor" > §< / a > < h3 class = "code-header" > impl < a class = "trait" href = "trait.TypedValueParser.html" title = "trait clap::builder::TypedValueParser" > TypedValueParser< / a > for < a class = "struct" href = "struct.BoolishValueParser.html" title = "struct clap::builder::BoolishValueParser" > BoolishValueParser< / a > < / h3 > < / section > < / summary > < div class = "impl-items" > < section id = "associatedtype.Value-2" class = "associatedtype trait-impl" > < a href = "#associatedtype.Value-2" class = "anchor" > §< / a > < h4 class = "code-header" > type < a href = "#associatedtype.Value" class = "associatedtype" > Value< / a > = < a class = "primitive" href = "https://doc.rust-lang.org/1.76.0/std/primitive.bool.html" > bool< / a > < / h4 > < / section > < / div > < / details > < details class = "toggle implementors-toggle" > < summary > < section id = "impl-TypedValueParser-for-FalseyValueParser" class = "impl" > < a class = "src rightside" href = "../../src/clap_builder/builder/value_parser.rs.html#1831" > source< / a > < a href = "#impl-TypedValueParser-for-FalseyValueParser" class = "anchor" > §< / a > < h3 class = "code-header" > impl < a class = "trait" href = "trait.TypedValueParser.html" title = "trait clap::builder::TypedValueParser" > TypedValueParser< / a > for < a class = "struct" href = "struct.FalseyValueParser.html" title = "struct clap::builder::FalseyValueParser" > FalseyValueParser< / a > < / h3 > < / section > < / summary > < div class = "impl-items" > < section id = "associatedtype.Value-3" class = "associatedtype trait-impl" > < a href = "#associatedtype.Value-3" class = "anchor" > §< / a > < h4 class = "code-header" > type < a href = "#associatedtype.Value" class = "associatedtype" > Value< / a > = < a class = "primitive" href = "https://doc.rust-lang.org/1.76.0/std/primitive.bool.html" > bool< / a > < / h4 > < / section > < / div > < / details > < details class = "toggle implementors-toggle" > < summary > < section id = "impl-TypedValueParser-for-NonEmptyStringValueParser" class = "impl" > < a class = "src rightside" href = "../../src/clap_builder/builder/value_parser.rs.html#2013" > source< / a > < a href = "#impl-TypedValueParser-for-NonEmptyStringValueParser" class = "anchor" > §< / a > < h3 class = "code-header" > impl < a class = "trait" href = "trait.TypedValueParser.html" title = "trait clap::builder::TypedValueParser" > TypedValueParser< / a > for < a class = "struct" href = "struct.NonEmptyStringValueParser.html" title = "struct clap::builder::NonEmptyStringValueParser" > NonEmptyStringValueParser< / a > < / h3 > < / section > < / summary > < div class = "impl-items" > < section id = "associatedtype.Value-4" class = "associatedtype trait-impl" > < a href = "#associatedtype
E: < a class = "trait" href = "../trait.ValueEnum.html" title = "trait clap::ValueEnum" > ValueEnum< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title = "trait core::clone::Clone" > Clone< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title = "trait core::marker::Send" > Send< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title = "trait core::marker::Sync" > Sync< / a > + 'static,< / div > < / h3 > < / section > < / summary > < div class = "impl-items" > < section id = "associatedtype.Value-10" class = "associatedtype trait-impl" > < a href = "#associatedtype.Value-10" class = "anchor" > §< / a > < h4 class = "code-header" > type < a href = "#associatedtype.Value" class = "associatedtype" > Value< / a > = E< / h4 > < / section > < / div > < / details > < details class = "toggle implementors-toggle" > < summary > < section id = "impl-TypedValueParser-for-F" class = "impl" > < a class = "src rightside" href = "../../src/clap_builder/builder/value_parser.rs.html#908-912" > source< / a > < a href = "#impl-TypedValueParser-for-F" class = "anchor" > §< / a > < h3 class = "code-header" > impl< F, T, E> < a class = "trait" href = "trait.TypedValueParser.html" title = "trait clap::builder::TypedValueParser" > TypedValueParser< / a > for F< div class = "where" > where
F: < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/ops/function/trait.Fn.html" title = "trait core::ops::function::Fn" > Fn< / a > (& < a class = "primitive" href = "https://doc.rust-lang.org/1.76.0/std/primitive.str.html" > str< / a > ) -> < a class = "enum" href = "https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title = "enum core::result::Result" > Result< / a > < T, E> + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title = "trait core::clone::Clone" > Clone< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title = "trait core::marker::Send" > Send< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title = "trait core::marker::Sync" > Sync< / a > + 'static,
E: < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html" title = "trait core::convert::Into" > Into< / a > < < a class = "struct" href = "https://doc.rust-lang.org/1.76.0/alloc/boxed/struct.Box.html" title = "struct alloc::boxed::Box" > Box< / a > < dyn < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/error/trait.Error.html" title = "trait core::error::Error" > Error< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title = "trait core::marker::Send" > Send< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title = "trait core::marker::Sync" > Sync< / a > > > ,
T: < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title = "trait core::marker::Send" > Send< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title = "trait core::marker::Sync" > Sync< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title = "trait core::clone::Clone" > Clone< / a > ,< / div > < / h3 > < / section > < / summary > < div class = "impl-items" > < section id = "associatedtype.Value-11" class = "associatedtype trait-impl" > < a href = "#associatedtype.Value-11" class = "anchor" > §< / a > < h4 class = "code-header" > type < a href = "#associatedtype.Value" class = "associatedtype" > Value< / a > = T< / h4 > < / section > < / div > < / details > < details class = "toggle implementors-toggle" > < summary > < section id = "impl-TypedValueParser-for-MapValueParser%3CP,+F%3E" class = "impl" > < a class = "src rightside" href = "../../src/clap_builder/builder/value_parser.rs.html#2067-2072" > source< / a > < a href = "#impl-TypedValueParser-for-MapValueParser%3CP,+F%3E" class = "anchor" > §< / a > < h3 class = "code-header" > impl< P, F, T> < a class = "trait" href = "trait.TypedValueParser.html" title = "trait clap::builder::TypedValueParser" > TypedValueParser< / a > for < a class = "struct" href = "struct.MapValueParser.html" title = "struct clap::builder::MapValueParser" > MapValueParser< / a > < P, F> < div class = "where" > where
P: < a class = "trait" href = "trait.TypedValueParser.html" title = "trait clap::builder::TypedValueParser" > TypedValueParser< / a > ,
< P as < a class = "trait" href = "trait.TypedValueParser.html" title = "trait clap::builder::TypedValueParser" > TypedValueParser< / a > > ::< a class = "associatedtype" href = "trait.TypedValueParser.html#associatedtype.Value" title = "type clap::builder::TypedValueParser::Value" > Value< / a > : < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title = "trait core::marker::Send" > Send< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title = "trait core::marker::Sync" > Sync< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title = "trait core::clone::Clone" > Clone< / a > ,
F: < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/ops/function/trait.Fn.html" title = "trait core::ops::function::Fn" > Fn< / a > (< P as < a class = "trait" href = "trait.TypedValueParser.html" title = "trait clap::builder::TypedValueParser" > TypedValueParser< / a > > ::< a class = "associatedtype" href = "trait.TypedValueParser.html#associatedtype.Value" title = "type clap::builder::TypedValueParser::Value" > Value< / a > ) -> T + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title = "trait core::clone::Clone" > Clone< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title = "trait core::marker::Send" > Send< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title = "trait core::marker::Sync" > Sync< / a > + 'static,
T: < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title = "trait core::marker::Send" > Send< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title = "trait core::marker::Sync" > Sync< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title = "trait core::clone::Clone" > Clone< / a > ,< / div > < / h3 > < / section > < / summary > < div class = "impl-items" > < section id = "associatedtype.Value-12" class = "associatedtype trait-impl" > < a href = "#associatedtype.Value-12" class = "anchor" > §< / a > < h4 class = "code-header" > type < a href = "#associatedtype.Value" class = "associatedtype" > Value< / a > = T< / h4 > < / section > < / div > < / details > < details class = "toggle implementors-toggle" > < summary > < section id = "impl-TypedValueParser-for-TryMapValueParser%3CP,+F%3E" class = "impl" > < a class = "src rightside" href = "../../src/clap_builder/builder/value_parser.rs.html#2127-2133" > source< / a > < a href = "#impl-TypedValueParser-for-TryMapValueParser%3CP,+F%3E" class = "anchor" > §< / a > < h3 class = "code-header" > impl< P, F, T, E> < a class = "trait" href = "trait.TypedValueParser.html" title = "trait clap::builder::TypedValueParser" > TypedValueParser< / a > for < a class = "struct" href = "struct.TryMapValueParser.html" title = "struct clap::builder::TryMapValueParser" > TryMapValueParser< / a > < P, F> < div class = "where" > where
P: < a class = "trait" href = "trait.TypedValueParser.html" title = "trait clap::builder::TypedValueParser" > TypedValueParser< / a > ,
< P as < a class = "trait" href = "trait.TypedValueParser.html" title = "trait clap::builder::TypedValueParser" > TypedValueParser< / a > > ::< a class = "associatedtype" href = "trait.TypedValueParser.html#associatedtype.Value" title = "type clap::builder::TypedValueParser::Value" > Value< / a > : < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title = "trait core::marker::Send" > Send< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title = "trait core::marker::Sync" > Sync< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title = "trait core::clone::Clone" > Clone< / a > ,
F: < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/ops/function/trait.Fn.html" title = "trait core::ops::function::Fn" > Fn< / a > (< P as < a class = "trait" href = "trait.TypedValueParser.html" title = "trait clap::builder::TypedValueParser" > TypedValueParser< / a > > ::< a class = "associatedtype" href = "trait.TypedValueParser.html#associatedtype.Value" title = "type clap::builder::TypedValueParser::Value" > Value< / a > ) -> < a class = "enum" href = "https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title = "enum core::result::Result" > Result< / a > < T, E> + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title = "trait core::clone::Clone" > Clone< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title = "trait core::marker::Send" > Send< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title = "trait core::marker::Sync" > Sync< / a > + 'static,
T: < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title = "trait core::marker::Send" > Send< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title = "trait core::marker::Sync" > Sync< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title = "trait core::clone::Clone" > Clone< / a > ,
E: < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html" title = "trait core::convert::Into" > Into< / a > < < a class = "struct" href = "https://doc.rust-lang.org/1.76.0/alloc/boxed/struct.Box.html" title = "struct alloc::boxed::Box" > Box< / a > < dyn < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/error/trait.Error.html" title = "trait core::error::Error" > Error< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title = "trait core::marker::Send" > Send< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title = "trait core::marker::Sync" > Sync< / a > > > ,< / div > < / h3 > < / section > < / summary > < div class = "impl-items" > < section id = "associatedtype.Value-13" class = "associatedtype trait-impl" > < a href = "#associatedtype.Value-13" class = "anchor" > §< / a > < h4 class = "code-header" > type < a href = "#associatedtype.Value" class = "associatedtype" > Value< / a > = T< / h4 > < / section > < / div > < / details > < details class = "toggle implementors-toggle" > < summary > < section id = "impl-TypedValueParser-for-RangedI64ValueParser%3CT%3E" class = "impl" > < a class = "src rightside" href = "../../src/clap_builder/builder/value_parser.rs.html#1434-1437" > source< / a > < a href = "#impl-TypedValueParser-for-RangedI64ValueParser%3CT%3E" class = "anchor" > §< / a > < h3 class = "code-header" > impl< T> < a class = "trait" href = "trait.TypedValueParser.html" title = "trait clap::builder::TypedValueParser" > TypedValueParser< / a > for < a class = "struct" href = "struct.RangedI64ValueParser.html" title = "struct clap::builder::RangedI64ValueParser" > RangedI64ValueParser< / a > < T> < div class = "where" > where
T: < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title = "trait core::convert::TryFrom" > TryFrom< / a > < < a class = "primitive" href = "https://doc.rust-lang.org/1.76.0/std/primitive.i64.html" > i64< / a > > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title = "trait core::clone::Clone" > Clone< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title = "trait core::marker::Send" > Send< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title = "trait core::marker::Sync" > Sync< / a > + 'static,
< T as < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title = "trait core::convert::TryFrom" > TryFrom< / a > < < a class = "primitive" href = "https://doc.rust-lang.org/1.76.0/std/primitive.i64.html" > i64< / a > > > ::< a class = "associatedtype" href = "https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" title = "type core::convert::TryFrom::Error" > Error< / a > : < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title = "trait core::marker::Send" > Send< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title = "trait core::marker::Sync" > Sync< / a > + 'static + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/error/trait.Error.html" title = "trait core::error::Error" > Error< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/alloc/string/trait.ToString.html" title = "trait alloc::string::ToString" > ToString< / a > ,< / div > < / h3 > < / section > < / summary > < div class = "impl-items" > < section id = "associatedtype.Value-14" class = "associatedtype trait-impl" > < a href = "#associatedtype.Value-14" class = "anchor" > §< / a > < h4 class = "code-header" > type < a href = "#associatedtype.Value" class = "associatedtype" > Value< / a > = T< / h4 > < / section > < / div > < / details > < details class = "toggle implementors-toggle" > < summary > < section id = "impl-TypedValueParser-for-RangedU64ValueParser%3CT%3E" class = "impl" > < a class = "src rightside" href = "../../src/clap_builder/builder/value_parser.rs.html#1634-1637" > source< / a > < a href = "#impl-TypedValueParser-for-RangedU64ValueParser%3CT%3E" class = "anchor" > §< / a > < h3 class = "code-header" > impl< T> < a class = "trait" href = "trait.TypedValueParser.html" title = "trait clap::builder::TypedValueParser" > TypedValueParser< / a > for < a class = "struct" href = "struct.RangedU64ValueParser.html" title = "struct clap::builder::RangedU64ValueParser" > RangedU64ValueParser< / a > < T> < div class = "where" > where
T: < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title = "trait core::convert::TryFrom" > TryFrom< / a > < < a class = "primitive" href = "https://doc.rust-lang.org/1.76.0/std/primitive.u64.html" > u64< / a > > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title = "trait core::clone::Clone" > Clone< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title = "trait core::marker::Send" > Send< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title = "trait core::marker::Sync" > Sync< / a > + 'static,
< T as < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title = "trait core::convert::TryFrom" > TryFrom< / a > < < a class = "primitive" href = "https://doc.rust-lang.org/1.76.0/std/primitive.u64.html" > u64< / a > > > ::< a class = "associatedtype" href = "https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" title = "type core::convert::TryFrom::Error" > Error< / a > : < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title = "trait core::marker::Send" > Send< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title = "trait core::marker::Sync" > Sync< / a > + 'static + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/core/error/trait.Error.html" title = "trait core::error::Error" > Error< / a > + < a class = "trait" href = "https://doc.rust-lang.org/1.76.0/alloc/string/trait.ToString.html" title = "trait alloc::string::ToString" > ToString< / a > ,< / div > < / h3 > < / section > < / summary > < div class = "impl-items" > < section id = "associatedtype.Value-15" class = "associatedtype trait-impl" > < a href = "#associatedtype.Value-15" class = "anchor" > §< / a > < h4 class = "code-header" > type < a href = "#associatedtype.Value" class = "associatedtype" > Value< / a > = T< / h4 > < / section > < / div > < / details > < / div > < script src = "../../trait.impl/clap_builder/builder/value_parser/trait.TypedValueParser.js" data-ignore-extern-crates = "clap_builder" async > < / script > < / section > < / div > < / main > < / body > < / html >