func (b *Buffer) Values() interface{} {
  return b.buffer.Slice(0, b.idx).Interface()
}
Values returns the values gathered from the last Consume call. The number of
values gathered will not exceed the length of the original slice passed
to NewBuffer. Returned value is a []T or []*T depending on whether
NewBuffer or NewPtrBuffer was used to create this instance. Returned
value remains valid until the next call to Consume.
package consume
import (
  "github.com/keep94/gofunctional2/functional"
  "reflect"
)
type ErrorReportingConsumer interface {
  functional.Consumer
  Error() error
}
func Compose(
    ptr interface{},
    copier functional.Copier,
    consumers ...ErrorReportingConsumer) ErrorReportingConsumer {
  return &compositeConsumer{ptr: ptr, copier: copier, consumers: consumers}
}
func Filter(
    c ErrorReportingConsumer, f functional.Filterer) ErrorReportingConsumer {
  return Modify(
      c,
      func(s functional.Stream) functional.Stream {
        return functional.Filter(f, s)
      })
}
func Modify(
    erc ErrorReportingConsumer,
    f func(s functional.Stream) functional.Stream) ErrorReportingConsumer {
  return &modifyConsumer{ErrorReportingConsumer: erc, f: f}
}
type Buffer struct {
  buffer reflect.Value
  addrFunc func(reflect.Value) interface{}
  err error
  idx int
}
func NewBuffer(aSlice interface{}) *Buffer {
  return &Buffer{buffer: sliceValue(aSlice, false), addrFunc: forValue}
}
func NewPtrBuffer(aSlice interface{}) *Buffer {
  return &Buffer{buffer: sliceValue(aSlice, true), addrFunc: forPtr}
}