gitlab.com/Raven-IO/raven-delve@v1.22.4/_fixtures/locationsprog_generic.go (about)

     1  package main
     2  
     3  import "fmt"
     4  
     5  type ParamReceiver[T any] struct {
     6  	field T
     7  }
     8  
     9  func (r *ParamReceiver[T]) Amethod() {
    10  	fmt.Printf("%v\n", r.field)
    11  }
    12  
    13  func ParamFunc[T any](arg T) {
    14  	fmt.Printf("%v\n", arg)
    15  }
    16  
    17  func main() {
    18  	var x ParamReceiver[int]
    19  	var y ParamReceiver[float64]
    20  	x.Amethod()
    21  	y.Amethod()
    22  	ParamFunc[int](2)
    23  	ParamFunc[float32](2)
    24  }