Debian Codegraph @

src/common/ident_bool.rs

raw symbols SCIP
1 use synrust-analyzer cargo syn 2.0.119 crate/::{
2 parserust-analyzer cargo syn 2.0.119 parse/::{Parserust-analyzer cargo syn 2.0.119 parse/Parse#, ParseStreamrust-analyzer cargo syn 2.0.119 parse/ParseStream#},
3 spannedrust-analyzer cargo syn 2.0.119 spanned/::Spannedrust-analyzer cargo syn 2.0.119 spanned/Spanned#,
4 Exprrust-analyzer cargo syn 2.0.119 expr/Expr#, Identrust-analyzer cargo proc-macro2 1.0.107 Ident#, Litrust-analyzer cargo syn 2.0.119 lit/Lit#, LitBoolrust-analyzer cargo syn 2.0.119 lit/LitBool#, LitStrrust-analyzer cargo syn 2.0.119 lit/LitStr#, Metarust-analyzer cargo syn 2.0.119 attr/Meta#, MetaNameValuerust-analyzer cargo syn 2.0.119 attr/MetaNameValue#,
5 };
6
7 use superrust-analyzer cargo educe 0.6.0 common/::pathrust-analyzer cargo educe 0.6.0 common/path/::path_to_stringrust-analyzer cargo educe 0.6.0 common/path/path_to_string().;
8
9 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
10 pub(craterust-analyzer cargo educe 0.6.0 crate/) enum IdentOrBoolrust-analyzer cargo educe 0.6.0 common/ident_bool/IdentOrBool# {
11 Identrust-analyzer cargo educe 0.6.0 common/ident_bool/IdentOrBool#Ident#(Identrust-analyzer cargo proc-macro2 1.0.107 Ident#),
12 Boolrust-analyzer cargo educe 0.6.0 common/ident_bool/IdentOrBool#Bool#(bool),
13 }
14
15 impl Parserust-analyzer cargo syn 2.0.119 parse/Parse# for IdentOrBoolrust-analyzer cargo educe 0.6.0 common/ident_bool/IdentOrBool# {
16 #[inline]
17 fn parserust-analyzer cargo educe 0.6.0 common/ident_bool/impl#[IdentOrBool][Parse]parse().(input: ParseStreamrust-analyzer cargo syn 2.0.119 parse/ParseStream#) -> synrust-analyzer cargo syn 2.0.119 crate/::Resultrust-analyzer cargo syn 2.0.119 error/Result#<Selfrust-analyzer cargo educe 0.6.0 common/ident_bool/impl#[IdentOrBool][Parse]> {
18 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(lit) = input.parserust-analyzer cargo syn 2.0.119 parse/impl#[`ParseBuffer<'a>`]parse().::<Litrust-analyzer cargo syn 2.0.119 lit/Lit#>() {
19 match lit {
20 Litrust-analyzer cargo syn 2.0.119 lit/Lit#::Boolrust-analyzer cargo syn 2.0.119 lit/Lit#Bool#(lit) => return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo educe 0.6.0 common/ident_bool/impl#[IdentOrBool][Parse]::Boolrust-analyzer cargo educe 0.6.0 common/ident_bool/IdentOrBool#Bool#(lit.valuerust-analyzer cargo syn 2.0.119 lit/LitBool#value.)),
21 Litrust-analyzer cargo syn 2.0.119 lit/Lit#::Strrust-analyzer cargo syn 2.0.119 lit/Lit#Str#(lit) => {
22 return match lit.parserust-analyzer cargo syn 2.0.119 lit/impl#[LitStr]parse().::<Identrust-analyzer cargo proc-macro2 1.0.107 Ident#>() {
23 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ident) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo educe 0.6.0 common/ident_bool/impl#[IdentOrBool][Parse]::Identrust-analyzer cargo educe 0.6.0 common/ident_bool/IdentOrBool#Ident#(ident)),
24 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_) if lit.valuerust-analyzer cargo syn 2.0.119 lit/impl#[LitStr]value().().is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().() => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo educe 0.6.0 common/ident_bool/impl#[IdentOrBool][Parse]::Boolrust-analyzer cargo educe 0.6.0 common/ident_bool/IdentOrBool#Bool#(false)),
25 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(error) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(error),
26 }
27 },
28 _ => (),
29 }
30 }
31
32 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo educe 0.6.0 common/ident_bool/impl#[IdentOrBool][Parse]::Identrust-analyzer cargo educe 0.6.0 common/ident_bool/IdentOrBool#Ident#(input.parserust-analyzer cargo syn 2.0.119 parse/impl#[`ParseBuffer<'a>`]parse().::<Identrust-analyzer cargo proc-macro2 1.0.107 Ident#>()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().))
33 }
34 }
35
36 #[inline]
37 pub(craterust-analyzer cargo educe 0.6.0 crate/) fn meta_name_value_2_identrust-analyzer cargo educe 0.6.0 common/ident_bool/meta_name_value_2_ident().(name_value: &MetaNameValuerust-analyzer cargo syn 2.0.119 attr/MetaNameValue#) -> synrust-analyzer cargo syn 2.0.119 crate/::Resultrust-analyzer cargo syn 2.0.119 error/Result#<Identrust-analyzer cargo proc-macro2 1.0.107 Ident#> {
38 match &name_value.valuerust-analyzer cargo syn 2.0.119 attr/MetaNameValue#value. {
39 Exprrust-analyzer cargo syn 2.0.119 expr/Expr#::Litrust-analyzer cargo syn 2.0.119 expr/Expr#Lit#(lit) => {
40 if let Litrust-analyzer cargo syn 2.0.119 lit/Lit#::Strrust-analyzer cargo syn 2.0.119 lit/Lit#Str#(lit) = &lit.litrust-analyzer cargo syn 2.0.119 expr/ExprLit#lit. {
41 return lit.parserust-analyzer cargo syn 2.0.119 lit/impl#[LitStr]parse().();
42 }
43 },
44 Exprrust-analyzer cargo syn 2.0.119 expr/Expr#::Pathrust-analyzer cargo syn 2.0.119 expr/Expr#Path#(path) => {
45 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ident) = path.pathrust-analyzer cargo syn 2.0.119 expr/ExprPath#path..get_identrust-analyzer cargo syn 2.0.119 path/impl#[Path]get_ident().() {
46 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ident.clonerust-analyzer cargo proc-macro2 1.0.107 impl#[Ident][Clone]clone().());
47 }
48 },
49 _ => (),
50 }
51
52 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error#::newrust-analyzer cargo syn 2.0.119 error/impl#[Error]new().(
53 name_value.valuerust-analyzer cargo syn 2.0.119 attr/MetaNameValue#value..spanrust-analyzer cargo syn 2.0.119 spanned/impl#[T][Spanned]span().(),
54 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("expected `{path} = Ident`", path = path_to_stringrust-analyzer cargo educe 0.6.0 common/path/path_to_string().(&name_value.pathrust-analyzer cargo syn 2.0.119 attr/MetaNameValue#path.)),
55 ))
56 }
57
58 #[inline]
59 pub(craterust-analyzer cargo educe 0.6.0 crate/) fn meta_2_identrust-analyzer cargo educe 0.6.0 common/ident_bool/meta_2_ident().(meta: &Metarust-analyzer cargo syn 2.0.119 attr/Meta#) -> synrust-analyzer cargo syn 2.0.119 crate/::Resultrust-analyzer cargo syn 2.0.119 error/Result#<Identrust-analyzer cargo proc-macro2 1.0.107 Ident#> {
60 match &meta {
61 Metarust-analyzer cargo syn 2.0.119 attr/Meta#::NameValuerust-analyzer cargo syn 2.0.119 attr/Meta#NameValue#(name_value) => meta_name_value_2_identrust-analyzer cargo educe 0.6.0 common/ident_bool/meta_name_value_2_ident().(name_value),
62 Metarust-analyzer cargo syn 2.0.119 attr/Meta#::Listrust-analyzer cargo syn 2.0.119 attr/Meta#List#(list) => {
63 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(lit) = list.parse_argsrust-analyzer cargo syn 2.0.119 attr/impl#[MetaList]parse_args().::<LitStrrust-analyzer cargo syn 2.0.119 lit/LitStr#>() {
64 lit.parserust-analyzer cargo syn 2.0.119 lit/impl#[LitStr]parse().()
65 } else {
66 list.parse_argsrust-analyzer cargo syn 2.0.119 attr/impl#[MetaList]parse_args().()
67 }
68 },
69 Metarust-analyzer cargo syn 2.0.119 attr/Meta#::Pathrust-analyzer cargo syn 2.0.119 attr/Meta#Path#(path) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error#::newrust-analyzer cargo syn 2.0.119 error/impl#[Error]new().(
70 path.spanrust-analyzer cargo syn 2.0.119 spanned/impl#[T][Spanned]span().(),
71 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("expected `{path} = Ident` or `{path}(Ident)`", path = path_to_stringrust-analyzer cargo educe 0.6.0 common/path/path_to_string().(path)),
72 )),
73 }
74 }
75
76 #[inline]
77 pub(craterust-analyzer cargo educe 0.6.0 crate/) fn meta_name_value_2_boolrust-analyzer cargo educe 0.6.0 common/ident_bool/meta_name_value_2_bool().(name_value: &MetaNameValuerust-analyzer cargo syn 2.0.119 attr/MetaNameValue#) -> synrust-analyzer cargo syn 2.0.119 crate/::Resultrust-analyzer cargo syn 2.0.119 error/Result#<bool> {
78 if let Exprrust-analyzer cargo syn 2.0.119 expr/Expr#::Litrust-analyzer cargo syn 2.0.119 expr/Expr#Lit#(lit) = &name_value.valuerust-analyzer cargo syn 2.0.119 attr/MetaNameValue#value. {
79 if let Litrust-analyzer cargo syn 2.0.119 lit/Lit#::Boolrust-analyzer cargo syn 2.0.119 lit/Lit#Bool#(b) = &lit.litrust-analyzer cargo syn 2.0.119 expr/ExprLit#lit. {
80 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(b.valuerust-analyzer cargo syn 2.0.119 lit/LitBool#value.);
81 }
82 }
83
84 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error#::newrust-analyzer cargo syn 2.0.119 error/impl#[Error]new().(
85 name_value.valuerust-analyzer cargo syn 2.0.119 attr/MetaNameValue#value..spanrust-analyzer cargo syn 2.0.119 spanned/impl#[T][Spanned]span().(),
86 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("expected `{path} = false`", path = path_to_stringrust-analyzer cargo educe 0.6.0 common/path/path_to_string().(&name_value.pathrust-analyzer cargo syn 2.0.119 attr/MetaNameValue#path.)),
87 ))
88 }
89
90 #[inline]
91 pub(craterust-analyzer cargo educe 0.6.0 crate/) fn meta_2_boolrust-analyzer cargo educe 0.6.0 common/ident_bool/meta_2_bool().(meta: &Metarust-analyzer cargo syn 2.0.119 attr/Meta#) -> synrust-analyzer cargo syn 2.0.119 crate/::Resultrust-analyzer cargo syn 2.0.119 error/Result#<bool> {
92 match &meta {
93 Metarust-analyzer cargo syn 2.0.119 attr/Meta#::NameValuerust-analyzer cargo syn 2.0.119 attr/Meta#NameValue#(name_value) => meta_name_value_2_boolrust-analyzer cargo educe 0.6.0 common/ident_bool/meta_name_value_2_bool().(name_value),
94 Metarust-analyzer cargo syn 2.0.119 attr/Meta#::Listrust-analyzer cargo syn 2.0.119 attr/Meta#List#(list) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(list.parse_argsrust-analyzer cargo syn 2.0.119 attr/impl#[MetaList]parse_args().::<LitBoolrust-analyzer cargo syn 2.0.119 lit/LitBool#>()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..valuerust-analyzer cargo syn 2.0.119 lit/LitBool#value.),
95 Metarust-analyzer cargo syn 2.0.119 attr/Meta#::Pathrust-analyzer cargo syn 2.0.119 attr/Meta#Path#(path) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error#::newrust-analyzer cargo syn 2.0.119 error/impl#[Error]new().(
96 path.spanrust-analyzer cargo syn 2.0.119 spanned/impl#[T][Spanned]span().(),
97 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("expected `{path} = false` or `{path}(false)`", path = path_to_stringrust-analyzer cargo educe 0.6.0 common/path/path_to_string().(path)),
98 )),
99 }
100 }
101
102 #[inline]
103 pub(craterust-analyzer cargo educe 0.6.0 crate/) fn meta_2_bool_allow_pathrust-analyzer cargo educe 0.6.0 common/ident_bool/meta_2_bool_allow_path().(meta: &Metarust-analyzer cargo syn 2.0.119 attr/Meta#) -> synrust-analyzer cargo syn 2.0.119 crate/::Resultrust-analyzer cargo syn 2.0.119 error/Result#<bool> {
104 match &meta {
105 Metarust-analyzer cargo syn 2.0.119 attr/Meta#::Pathrust-analyzer cargo syn 2.0.119 attr/Meta#Path#(_) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(true),
106 Metarust-analyzer cargo syn 2.0.119 attr/Meta#::NameValuerust-analyzer cargo syn 2.0.119 attr/Meta#NameValue#(name_value) => meta_name_value_2_boolrust-analyzer cargo educe 0.6.0 common/ident_bool/meta_name_value_2_bool().(name_value),
107 Metarust-analyzer cargo syn 2.0.119 attr/Meta#::Listrust-analyzer cargo syn 2.0.119 attr/Meta#List#(list) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(list.parse_argsrust-analyzer cargo syn 2.0.119 attr/impl#[MetaList]parse_args().::<LitBoolrust-analyzer cargo syn 2.0.119 lit/LitBool#>()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..valuerust-analyzer cargo syn 2.0.119 lit/LitBool#value.),
108 }
109 }
110
111 #[inline]
112 pub(craterust-analyzer cargo educe 0.6.0 crate/) fn meta_name_value_2_ident_and_boolrust-analyzer cargo educe 0.6.0 common/ident_bool/meta_name_value_2_ident_and_bool().(
113 name_value: &MetaNameValuerust-analyzer cargo syn 2.0.119 attr/MetaNameValue#,
114 ) -> synrust-analyzer cargo syn 2.0.119 crate/::Resultrust-analyzer cargo syn 2.0.119 error/Result#<IdentOrBoolrust-analyzer cargo educe 0.6.0 common/ident_bool/IdentOrBool#> {
115 match &name_value.valuerust-analyzer cargo syn 2.0.119 attr/MetaNameValue#value. {
116 Exprrust-analyzer cargo syn 2.0.119 expr/Expr#::Litrust-analyzer cargo syn 2.0.119 expr/Expr#Lit#(lit) => match &lit.litrust-analyzer cargo syn 2.0.119 expr/ExprLit#lit. {
117 Litrust-analyzer cargo syn 2.0.119 lit/Lit#::Strrust-analyzer cargo syn 2.0.119 lit/Lit#Str#(lit) => match lit.parserust-analyzer cargo syn 2.0.119 lit/impl#[LitStr]parse().::<Identrust-analyzer cargo proc-macro2 1.0.107 Ident#>() {
118 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ident) => return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(IdentOrBoolrust-analyzer cargo educe 0.6.0 common/ident_bool/IdentOrBool#::Identrust-analyzer cargo educe 0.6.0 common/ident_bool/IdentOrBool#Ident#(ident)),
119 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_) if lit.valuerust-analyzer cargo syn 2.0.119 lit/impl#[LitStr]value().().is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().() => {
120 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(IdentOrBoolrust-analyzer cargo educe 0.6.0 common/ident_bool/IdentOrBool#::Boolrust-analyzer cargo educe 0.6.0 common/ident_bool/IdentOrBool#Bool#(false));
121 },
122 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(error) => {
123 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(error);
124 },
125 },
126 Litrust-analyzer cargo syn 2.0.119 lit/Lit#::Boolrust-analyzer cargo syn 2.0.119 lit/Lit#Bool#(lit) => {
127 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(IdentOrBoolrust-analyzer cargo educe 0.6.0 common/ident_bool/IdentOrBool#::Boolrust-analyzer cargo educe 0.6.0 common/ident_bool/IdentOrBool#Bool#(lit.valuerust-analyzer cargo syn 2.0.119 lit/LitBool#value.));
128 },
129 _ => (),
130 },
131 Exprrust-analyzer cargo syn 2.0.119 expr/Expr#::Pathrust-analyzer cargo syn 2.0.119 expr/Expr#Path#(path) => {
132 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ident) = path.pathrust-analyzer cargo syn 2.0.119 expr/ExprPath#path..get_identrust-analyzer cargo syn 2.0.119 path/impl#[Path]get_ident().() {
133 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(IdentOrBoolrust-analyzer cargo educe 0.6.0 common/ident_bool/IdentOrBool#::Identrust-analyzer cargo educe 0.6.0 common/ident_bool/IdentOrBool#Ident#(ident.clonerust-analyzer cargo proc-macro2 1.0.107 impl#[Ident][Clone]clone().()));
134 }
135 },
136 _ => (),
137 }
138
139 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error#::newrust-analyzer cargo syn 2.0.119 error/impl#[Error]new().(
140 name_value.valuerust-analyzer cargo syn 2.0.119 attr/MetaNameValue#value..spanrust-analyzer cargo syn 2.0.119 spanned/impl#[T][Spanned]span().(),
141 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!(
142 "expected `{path} = Ident` or `{path} = false`",
143 path = path_to_stringrust-analyzer cargo educe 0.6.0 common/path/path_to_string().(&name_value.pathrust-analyzer cargo syn 2.0.119 attr/MetaNameValue#path.)
144 ),
145 ))
146 }
147
148 #[inline]
149 pub(craterust-analyzer cargo educe 0.6.0 crate/) fn meta_2_ident_and_boolrust-analyzer cargo educe 0.6.0 common/ident_bool/meta_2_ident_and_bool().(meta: &Metarust-analyzer cargo syn 2.0.119 attr/Meta#) -> synrust-analyzer cargo syn 2.0.119 crate/::Resultrust-analyzer cargo syn 2.0.119 error/Result#<IdentOrBoolrust-analyzer cargo educe 0.6.0 common/ident_bool/IdentOrBool#> {
150 match &meta {
151 Metarust-analyzer cargo syn 2.0.119 attr/Meta#::NameValuerust-analyzer cargo syn 2.0.119 attr/Meta#NameValue#(name_value) => meta_name_value_2_ident_and_boolrust-analyzer cargo educe 0.6.0 common/ident_bool/meta_name_value_2_ident_and_bool().(name_value),
152 Metarust-analyzer cargo syn 2.0.119 attr/Meta#::Listrust-analyzer cargo syn 2.0.119 attr/Meta#List#(list) => list.parse_argsrust-analyzer cargo syn 2.0.119 attr/impl#[MetaList]parse_args().::<IdentOrBoolrust-analyzer cargo educe 0.6.0 common/ident_bool/IdentOrBool#>(),
153 Metarust-analyzer cargo syn 2.0.119 attr/Meta#::Pathrust-analyzer cargo syn 2.0.119 attr/Meta#Path#(path) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error#::newrust-analyzer cargo syn 2.0.119 error/impl#[Error]new().(
154 path.spanrust-analyzer cargo syn 2.0.119 spanned/impl#[T][Spanned]span().(),
155 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!(
156 "expected `{path} = Ident`, `{path}(Ident)`, `{path} = false`, or `{path}(false)`",
157 path = path_to_stringrust-analyzer cargo educe 0.6.0 common/path/path_to_string().(path)
158 ),
159 )),
160 }
161 }