v/vlib/v/parser/tests/generic_struct_parameter_er...

24 lines
286 B
V

import datatypes { LinkedList }
struct MyNode<T> {
mut:
data T
}
struct MyContainer<T> {
mut:
lst LinkedList<MyNode<T>>
}
fn (mut c MyContainer<T>) push(data T) {
node := MyNode<T>{
data: data
}
c.lst.push<T>(node)
}
fn main() {
mut c := MyContainer<string>{}
println(c)
}