pub struct Parsed<T>(pub T);Expand description
Any FromStr type as a value: the text is parsed with
str::parse, and its error becomes the invalid value’s cause.
For a type from another crate, which can implement neither FromArg
here nor derive ValueEnum (a strum enum, say).
use winnow_args::FromArg;
use winnow_args::value::Parsed;
let Parsed(ip) = Parsed::<std::net::Ipv4Addr>::from_arg("127.0.0.1".into())?;
assert!(ip.is_loopback());
assert!(Parsed::<std::net::Ipv4Addr>::from_arg("localhost".into()).is_err());Tuple Fields§
§0: TTrait Implementations§
impl<T: Copy> Copy for Parsed<T>
impl<T: Eq> Eq for Parsed<T>
Source§impl<T> FromArg for Parsed<T>
impl<T> FromArg for Parsed<T>
Source§const CHOICES: &'static [&'static str] = _
const CHOICES: &'static [&'static str] = _
The values accepted, when there is a fixed set: help lists them as
[possible values: …]. Empty by default; #[derive(ValueEnum)] fills
it with each visible variant’s name.Source§const HINT: Hint = crate::complete::Hint::Nothing
const HINT: Hint = crate::complete::Hint::Nothing
What the value is, for the shell that completes it, when a field
states no
hint. Nothing a shell knows by default: a number, an
address, a type of the program. A PathBuf, a String and an
OsString are a file: a word is one more often than not, and a shell
that offers files stops no other word from being typed.Source§impl<T: Ord> Ord for Parsed<T>
impl<T: Ord> Ord for Parsed<T>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl<T: PartialOrd> PartialOrd for Parsed<T>
impl<T: PartialOrd> PartialOrd for Parsed<T>
impl<T: PartialEq> StructuralPartialEq for Parsed<T>
Auto Trait Implementations§
impl<T> Freeze for Parsed<T>where
T: Freeze,
impl<T> RefUnwindSafe for Parsed<T>where
T: RefUnwindSafe,
impl<T> Send for Parsed<T>where
T: Send,
impl<T> Sync for Parsed<T>where
T: Sync,
impl<T> Unpin for Parsed<T>where
T: Unpin,
impl<T> UnsafeUnpin for Parsed<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Parsed<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more