MCPcopy Create free account
hub / github.com/FunctionStream/function-stream / ReceiveFromChannel

Function ReceiveFromChannel

common/chan_utils.go:38–45  ·  view source on GitHub ↗
(ctx context.Context, c <-chan T)

Source from the content-addressed store, hash-verified

36}
37
38func ReceiveFromChannel[T any](ctx context.Context, c <-chan T) (T, bool) {
39 select {
40 case e := <-c:
41 return e, true
42 case <-ctx.Done():
43 return zeroValue[T](), false
44 }
45}

Callers 2

generateTrafficMethod · 0.92
TestReceiveFromChannelFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestReceiveFromChannelFunction · 0.68