2024-09-09 14:34:00 +00:00
|
|
|
// Package toolkit contains useful utilities which are not specific to any
|
|
|
|
// specific part of isle.
|
|
|
|
package toolkit
|
2024-09-10 20:51:33 +00:00
|
|
|
|
|
|
|
import "reflect"
|
|
|
|
|
|
|
|
// IsZero returns true if the value is equal to its zero value according to
|
|
|
|
// reflect.DeepEqual.
|
|
|
|
func IsZero[T any](v T) bool {
|
|
|
|
var zero T
|
|
|
|
return reflect.DeepEqual(v, zero)
|
|
|
|
}
|
2024-12-17 10:33:19 +00:00
|
|
|
|
|
|
|
// Ptr returns a pointer to the given value.
|
|
|
|
func Ptr[T any](v T) *T {
|
|
|
|
return &v
|
|
|
|
}
|