This commit is contained in:
milarin 2024-04-04 19:11:33 +02:00
parent 3dfcee4ee4
commit faf75185ae

View File

@ -64,7 +64,7 @@ func (r Result[T]) Err() error {
} }
func FilterSuccess[T any](source <-chan Result[T]) <-chan T { func FilterSuccess[T any](source <-chan Result[T]) <-chan T {
succeeded := Filter(source, func(r Result[T]) bool { return r.Success() }) succeeded := Filter(source, Result[T].Success)
return MapSuccessive(succeeded, func(r Result[T]) T { return MapSuccessive(succeeded, func(r Result[T]) T {
v, _ := r.Get() v, _ := r.Get()
@ -73,7 +73,7 @@ func FilterSuccess[T any](source <-chan Result[T]) <-chan T {
} }
func FilterFail[T any](source <-chan Result[T]) <-chan T { func FilterFail[T any](source <-chan Result[T]) <-chan T {
failed := Filter(source, func(r Result[T]) bool { return r.Fail() }) failed := Filter(source, Result[T].Fail)
return MapSuccessive(failed, func(r Result[T]) T { return MapSuccessive(failed, func(r Result[T]) T {
v, _ := r.Get() v, _ := r.Get()
@ -94,7 +94,7 @@ func FilterResults[T any](source <-chan Result[T]) (succeeded <-chan T, failed <
fail <- r.Err() fail <- r.Err()
continue continue
} }
succ <- r.GetSafe() succ <- r.GetUnsafe()
} }
}() }()