v2 / vlib / v / fmt / tests / struct_init_with_comments_keep.vv
20 lines · 18 sloc · 417 bytes · c69dfefedb57ded4be29c2e90660b68ba458d4e0
Raw
1module abcde
2
3pub struct Builder {
4pub mut:
5 // inline before field
6 buf []u8
7 str_calls int
8 len int
9 initial_size int = 1
10}
11
12pub fn new_builder(initial_size int) Builder {
13 return Builder{
14 // buf: make(0, initial_size)
15 buf: []u8{cap: initial_size}
16 str_calls: 0 // after str_calls
17 len: 0 // after len
18 initial_size: initial_size // final
19 }
20}
21