| 1 | struct Product { |
| 2 | pub mut: |
| 3 | id int = 2 |
| 4 | sku string = 'ABCD' |
| 5 | ean13 string = 'EFGH' |
| 6 | |
| 7 | collections string |
| 8 | ptype string |
| 9 | featured_image string |
| 10 | featured_media string |
| 11 | handle string |
| 12 | variant int |
| 13 | } |
| 14 | |
| 15 | pub fn (p Product) save() string { |
| 16 | return do_something(p) |
| 17 | } |
| 18 | |
| 19 | fn do_something[T](p T) string { |
| 20 | return 'whatever' |
| 21 | } |
| 22 | |
| 23 | fn test_generics_in_big_struct_method() { |
| 24 | mut p := Product{} |
| 25 | println(p.save()) |
| 26 | assert p.save() == 'whatever' |
| 27 | } |
| 28 |