MCPcopy Create free account
hub / github.com/ReactiveX/RxGo / next

Method next

observable_operator.go:115–130  ·  view source on GitHub ↗
(ctx context.Context, item Item, dst chan<- Item, operatorOptions operatorOptions)

Source from the content-addressed store, hash-verified

113}
114
115func (op *averageFloat64Operator) next(ctx context.Context, item Item, dst chan<- Item, operatorOptions operatorOptions) {
116 switch v := item.V.(type) {
117 default:
118 Error(IllegalInputError{error: fmt.Sprintf("expected type: float or int, got: %t", item)}).SendContext(ctx, dst)
119 operatorOptions.stop()
120 case int:
121 op.sum += float64(v)
122 op.count++
123 case float32:
124 op.sum += float64(v)
125 op.count++
126 case float64:
127 op.sum += v
128 op.count++
129 }
130}
131
132func (op *averageFloat64Operator) err(ctx context.Context, item Item, dst chan<- Item, operatorOptions operatorOptions) {
133 defaultErrorFuncOperator(ctx, item, dst, operatorOptions)

Callers

nothing calls this directly

Calls 2

ErrorFunction · 0.85
SendContextMethod · 0.80

Tested by

no test coverage detected