16 lines
203 B
Go
16 lines
203 B
Go
|
package channel
|
||
|
|
||
|
type Any[T any] chan T
|
||
|
|
||
|
func NewAny[T any]() Any[T] {
|
||
|
return make(Any[T])
|
||
|
}
|
||
|
|
||
|
func NewBufferAny[T any](i int) Any[T] {
|
||
|
return make(Any[T], i)
|
||
|
}
|
||
|
|
||
|
func (ch Any[T]) Send(v T) {
|
||
|
ch <- v
|
||
|
}
|