Generate Self construction syntax. - tuple struct: `Self(field0, field1, ...)` - named struct: `Self { field0, field1, ... }`
(is_tuple_struct: bool, field_inits: &[TokenStream])
| 50 | /// - tuple struct: `Self(field0, field1, ...)` |
| 51 | /// - named struct: `Self { field0, field1, ... }` |
| 52 | pub fn self_construction(is_tuple_struct: bool, field_inits: &[TokenStream]) -> TokenStream { |
| 53 | if is_tuple_struct { |
| 54 | quote! { Self( #(#field_inits),* ) } |
| 55 | } else { |
| 56 | quote! { Self { #(#field_inits),* } } |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | /// Generate Ok(Self(...)) construction syntax for Result return. |
| 61 | pub fn ok_self_construction(is_tuple_struct: bool, field_inits: &[TokenStream]) -> TokenStream { |
no outgoing calls
no test coverage detected