MCPcopy Create free account
hub / github.com/apache/fory / field_init

Method field_init

rust/fory-derive/src/util.rs:39–46  ·  view source on GitHub ↗

Generate field initialization syntax for struct construction. - tuple struct: just the value - named struct: `field_name: value`

(&self, value: TokenStream)

Source from the content-addressed store, hash-verified

37 /// - tuple struct: just the value
38 /// - named struct: `field_name: value`
39 pub fn field_init(&self, value: TokenStream) -> TokenStream {
40 if self.is_tuple_struct {
41 value
42 } else {
43 let ident = format_ident!("{}", self.field_name);
44 quote! { #ident: #value }
45 }
46 }
47}
48
49/// Generate Self construction syntax.

Callers 3

assign_valueFunction · 0.80
gen_read_dataFunction · 0.80
generate_default_implFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected