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

Method BufferWithCount

observable_operator.go:400–411  ·  view source on GitHub ↗

BufferWithCount returns an Observable that emits buffers of items it collects from the source Observable. The resulting Observable emits buffers every skip items, each containing a slice of count items. When the source Observable completes or encounters an error, the resulting Observable emits the c

(count int, opts ...Option)

Source from the content-addressed store, hash-verified

398// the resulting Observable emits the current buffer and propagates
399// the notification from the source Observable.
400func (o *ObservableImpl) BufferWithCount(count int, opts ...Option) Observable {
401 if count <= 0 {
402 return Thrown(IllegalInputError{error: "count must be positive"})
403 }
404
405 return observable(o.parent, o, func() operator {
406 return &bufferWithCountOperator{
407 count: count,
408 buffer: make([]interface{}, count),
409 }
410 }, true, false, opts...)
411}
412
413type bufferWithCountOperator struct {
414 count int

Callers

nothing calls this directly

Calls 2

ThrownFunction · 0.85
observableFunction · 0.85

Tested by

no test coverage detected