Compare commits

..

No commits in common. "169f978e1490cbd9a9461e33e5ece17b4d917aac" and "ba2efffd8ebea961d9a5cae9694365281e9879cf" have entirely different histories.

19
find.go
View File

@ -1,7 +1,5 @@
package channel
import "context"
func FindFirst[T any](source <-chan T) *T {
for v := range source {
return &v
@ -9,14 +7,6 @@ func FindFirst[T any](source <-chan T) *T {
return nil
}
func FindFirstAndCancel[T any](source <-chan T, cancel context.CancelFunc) *T {
for v := range source {
cancel()
return &v
}
return nil
}
func FindFirstAndFlush[T any](source <-chan T) *T {
for v := range source {
go Flush(source)
@ -25,15 +15,6 @@ func FindFirstAndFlush[T any](source <-chan T) *T {
return nil
}
func FindFirstAndCancelFlush[T any](source <-chan T, cancel context.CancelFunc) *T {
for v := range source {
cancel()
go Flush(source)
return &v
}
return nil
}
func FindLast[T any](source <-chan T) *T {
var last *T = new(T)
found := false