github.com/enbility/spine-go@v0.7.0/util/type.go (about)

     1  package util
     2  
     3  import "reflect"
     4  
     5  func Type[T any]() reflect.Type {
     6  	return reflect.TypeOf((*T)(nil)).Elem()
     7  }
     8  
     9  // checks if type T implements interface I
    10  func Implements[T any, I any]() bool {
    11  	_, supported := any((*T)(nil)).(I)
    12  	return supported
    13  }