clap_builder/builder/
app_settings.rs1#[allow(unused)]
2use crate::Arg;
3#[allow(unused)]
4use crate::Command;
5
6#[derive(#[automatically_derived]
impl ::core::default::Default for AppFlags {
#[inline]
fn default() -> AppFlags { AppFlags(::core::default::Default::default()) }
}Default, #[automatically_derived]
impl ::core::marker::Copy for AppFlags { }Copy, #[automatically_derived]
impl ::core::clone::Clone for AppFlags {
#[inline]
fn clone(&self) -> AppFlags {
let _: ::core::clone::AssertParamIsClone<u32>;
*self
}
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for AppFlags {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_tuple_field1_finish(f, "AppFlags",
&&self.0)
}
}Debug, #[automatically_derived]
impl ::core::cmp::PartialEq for AppFlags {
#[inline]
fn eq(&self, other: &AppFlags) -> bool { self.0 == other.0 }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for AppFlags {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<u32>;
}
}Eq)]
7pub(crate) struct AppFlags(u32);
8
9impl AppFlags {
10 pub(crate) fn set(&mut self, setting: AppSettings) {
11 self.0 |= setting.bit();
12 }
13
14 pub(crate) fn unset(&mut self, setting: AppSettings) {
15 self.0 &= !setting.bit();
16 }
17
18 pub(crate) fn is_set(&self, setting: AppSettings) -> bool {
19 self.0 & setting.bit() != 0
20 }
21
22 pub(crate) fn insert(&mut self, other: Self) {
23 self.0 |= other.0;
24 }
25}
26
27impl std::ops::BitOr for AppFlags {
28 type Output = Self;
29
30 fn bitor(mut self, rhs: Self) -> Self::Output {
31 self.insert(rhs);
32 self
33 }
34}
35
36#[derive(#[automatically_derived]
impl ::core::fmt::Debug for AppSettings {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
AppSettings::IgnoreErrors => "IgnoreErrors",
AppSettings::AllowHyphenValues => "AllowHyphenValues",
AppSettings::AllowNegativeNumbers => "AllowNegativeNumbers",
AppSettings::AllArgsOverrideSelf => "AllArgsOverrideSelf",
AppSettings::AllowMissingPositional =>
"AllowMissingPositional",
AppSettings::TrailingVarArg => "TrailingVarArg",
AppSettings::DontDelimitTrailingValues =>
"DontDelimitTrailingValues",
AppSettings::InferLongArgs => "InferLongArgs",
AppSettings::InferSubcommands => "InferSubcommands",
AppSettings::SubcommandRequired => "SubcommandRequired",
AppSettings::AllowExternalSubcommands =>
"AllowExternalSubcommands",
AppSettings::Multicall => "Multicall",
AppSettings::SubcommandsNegateReqs => "SubcommandsNegateReqs",
AppSettings::ArgsNegateSubcommands => "ArgsNegateSubcommands",
AppSettings::SubcommandPrecedenceOverArg =>
"SubcommandPrecedenceOverArg",
AppSettings::FlattenHelp => "FlattenHelp",
AppSettings::ArgRequiredElseHelp => "ArgRequiredElseHelp",
AppSettings::NextLineHelp => "NextLineHelp",
AppSettings::DisableColoredHelp => "DisableColoredHelp",
AppSettings::DisableHelpFlag => "DisableHelpFlag",
AppSettings::DisableHelpSubcommand => "DisableHelpSubcommand",
AppSettings::DisableVersionFlag => "DisableVersionFlag",
AppSettings::PropagateVersion => "PropagateVersion",
AppSettings::Hidden => "Hidden",
AppSettings::HidePossibleValues => "HidePossibleValues",
AppSettings::HelpExpected => "HelpExpected",
AppSettings::NoBinaryName => "NoBinaryName",
AppSettings::ColorAuto => "ColorAuto",
AppSettings::ColorAlways => "ColorAlways",
AppSettings::ColorNever => "ColorNever",
AppSettings::Built => "Built",
AppSettings::BinNameBuilt => "BinNameBuilt",
})
}
}Debug, #[automatically_derived]
impl ::core::cmp::PartialEq for AppSettings {
#[inline]
fn eq(&self, other: &AppSettings) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::marker::Copy for AppSettings { }Copy, #[automatically_derived]
impl ::core::clone::Clone for AppSettings {
#[inline]
fn clone(&self) -> AppSettings { *self }
}Clone)]
47#[repr(u8)]
48pub(crate) enum AppSettings {
49 IgnoreErrors,
50 AllowHyphenValues,
51 AllowNegativeNumbers,
52 AllArgsOverrideSelf,
53 AllowMissingPositional,
54 TrailingVarArg,
55 DontDelimitTrailingValues,
56 InferLongArgs,
57 InferSubcommands,
58 SubcommandRequired,
59 AllowExternalSubcommands,
60 Multicall,
61 SubcommandsNegateReqs,
62 ArgsNegateSubcommands,
63 SubcommandPrecedenceOverArg,
64 FlattenHelp,
65 ArgRequiredElseHelp,
66 NextLineHelp,
67 DisableColoredHelp,
68 DisableHelpFlag,
69 DisableHelpSubcommand,
70 DisableVersionFlag,
71 PropagateVersion,
72 Hidden,
73 HidePossibleValues,
74 HelpExpected,
75 NoBinaryName,
76 #[allow(dead_code)]
77 ColorAuto,
78 ColorAlways,
79 ColorNever,
80 Built,
81 BinNameBuilt,
82}
83
84impl AppSettings {
85 fn bit(self) -> u32 {
86 1 << (self as u8)
87 }
88}