MCPcopy Create free account
hub / github.com/biblius/validify / quote_modifier_param

Method quote_modifier_param

validify_derive/src/fields.rs:167–182  ·  view source on GitHub ↗

Returns `self.#ident`, unless the field is an option in which case it just returns an `#ident` as we always do a `if let` check on Option fields

(&self)

Source from the content-addressed store, hash-verified

165 /// Returns `self.#ident`, unless the field is an option in which case it just
166 /// returns an `#ident` as we always do a `if let` check on Option fields
167 pub fn quote_modifier_param(&self) -> proc_macro2::TokenStream {
168 let ident = &self.field.ident;
169
170 if self.is_reference() {
171 abort!(
172 ident.span(),
173 "Fields containing modifiers must contain owned data"
174 )
175 }
176
177 if self.is_option() {
178 quote!(#ident)
179 } else {
180 quote!(self.#ident)
181 }
182 }
183
184 /// Returns either
185 ///

Callers 1

to_validify_tokensMethod · 0.80

Calls 2

is_referenceMethod · 0.80
is_optionMethod · 0.80

Tested by

no test coverage detected