Debian Codegraph @

debian/rust-vendor/clap_builder/src/builder/arg_predicate.rs

raw
1 use crate::builder::OsStr;
2
3 /// Operations to perform on argument values
4 ///
5 /// These do not apply to [`ValueSource::DefaultValue`][crate::parser::ValueSource::DefaultValue]
6 #[derive(Clone, Debug, PartialEq, Eq)]
7 #[cfg_attr(feature = "unstable-v5", non_exhaustive)]
8 pub enum ArgPredicate {
9 /// Is the argument present?
10 IsPresent,
11 /// Does the argument match the specified value?
12 Equals(OsStr),
13 }
14
15 impl<S: Into<OsStr>> From<S> for ArgPredicate {
16 fn from(other: S) -> Self {
17 Self::Equals(other.into())
18 }
19 }