| 1 | struct GenericChannelStruct[T] { |
| 2 | ch chan T |
| 3 | } |
| 4 | |
| 5 | struct MyGenericChannelStruct { |
| 6 | GenericChannelStruct[T] |
| 7 | msg string |
| 8 | } |
| 9 | |
| 10 | struct Simple { |
| 11 | msg string |
| 12 | } |
| 13 | |
| 14 | fn main() { |
| 15 | new_channel_struct[Simple]() |
| 16 | } |
| 17 | |
| 18 | pub fn new_channel_struct[T]() GenericChannelStruct[T] { |
| 19 | d := GenericChannelStruct[T]{ |
| 20 | ch: chan T{} |
| 21 | } |
| 22 | |
| 23 | return d |
| 24 | } |
| 25 |