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

Method wrap_modifier_if_option

validify_derive/src/fields.rs:256–272  ·  view source on GitHub ↗
(
        &self,
        tokens: proc_macro2::TokenStream,
    )

Source from the content-addressed store, hash-verified

254 }
255
256 pub fn wrap_modifier_if_option(
257 &self,
258 tokens: proc_macro2::TokenStream,
259 ) -> proc_macro2::TokenStream {
260 let field_ident = &self.field.ident;
261
262 if self.is_option() {
263 let this = self.option_self_tokens_modifications();
264 return quote!(
265 if let #this = self.#field_ident.as_mut() {
266 #tokens
267 }
268 );
269 }
270
271 tokens
272 }
273
274 /// Wrap the quoted output of a modification in a for loop if
275 /// the field type is a collection.

Callers 1

to_validify_tokensMethod · 0.80

Calls 2

is_optionMethod · 0.80

Tested by

no test coverage detected