clap_builder/builder/
arg_predicate.rs

1use 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)]
8pub enum ArgPredicate {
9    /// Is the argument present?
10    IsPresent,
11    /// Does the argument match the specified value?
12    Equals(OsStr),
13}
14
15impl<S: Into<OsStr>> From<S> for ArgPredicate {
16    fn from(other: S) -> Self {
17        Self::Equals(other.into())
18    }
19}