2023-01-19 11:51:46 +00:00
|
|
|
package other
|
|
|
|
|
|
|
|
// OutputIntoChannel takes a singular return value and sends it into the target channel.
|
|
|
|
// This is a wrapper for functions where a value can't be collected from directly.
|
|
|
|
// Example: goroutines
|
|
|
|
func OutputIntoChannel[T any](out T, target chan T) {
|
|
|
|
target <- out
|
|
|
|
}
|
2023-08-18 15:14:04 +00:00
|
|
|
|
|
|
|
func Must[T any](val T, err error) T {
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return val
|
|
|
|
}
|
2024-07-07 14:00:08 +00:00
|
|
|
|
|
|
|
func IntoPointer[T any](val T) *T {
|
|
|
|
return &val
|
|
|
|
}
|