func (rw *ReadWriteBuffer) Shape() (int, int) {
	return len(rw.d), rw.m
}
Shape returns the current ReadWriteBuffer size and its maximum if one was provided.
package buffer
import (
	"errors"
	"io"
)
type ReadWriteBuffer struct {
	d []byte
	i int64  
	m int
}
func NewReadWriteBuffer(size, max int) *ReadWriteBuffer {
	if max < size && max >= 0 {
		max = size
	}
	return &ReadWriteBuffer{make([]byte, size), 0, max}
}
func (rw *ReadWriteBuffer) Reset(b []byte) {
	*rw = ReadWriteBuffer{b, 0, rw.m}
}
func (rw *ReadWriteBuffer) Len() int {
	if rw.i >= int64(len(rw.d)) {
		return 0
	}
	return int(int64(len(rw.d)) - rw.i)
}
func (rw *ReadWriteBuffer) Size() int64 { return int64(len(rw.d)) }
func (rw *ReadWriteBuffer) SetMax(max int) {
	if max < len(rw.d) && max >= 0 {
		max = len(rw.d)
	}
	rw.m = max
}
func (rw *ReadWriteBuffer) Bytes() []byte {
	return rw.d
}