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

Method quote_validator_field

validify_derive/src/fields.rs:189–197  ·  view source on GitHub ↗

Returns either `field` or `self.field` depending on whether the field is an Option or collection.

(&self)

Source from the content-addressed store, hash-verified

187 ///
188 /// depending on whether the field is an Option or collection.
189 pub fn quote_validator_field(&self) -> proc_macro2::TokenStream {
190 let ident = &self.field.ident;
191
192 if self.is_option() || self.is_list() || self.is_map() {
193 quote!(#ident)
194 } else {
195 quote!(self.#ident)
196 }
197 }
198
199 /// Wrap the provided tokens in an `if let Some` block if the field is an option.
200 pub fn wrap_tokens_if_option(

Callers 1

to_validify_tokensMethod · 0.80

Calls 3

is_optionMethod · 0.80
is_listMethod · 0.80
is_mapMethod · 0.80

Tested by

no test coverage detected