package circbuf
import "github.com/armon/circbuf"
Index ¶
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer implements a circular buffer. It is a fixed size, and new writes overwrite older data, such that for a buffer of size N, for any amount of writes, only the last N bytes are retained.
func NewBuffer ¶
NewBuffer creates a new buffer of a given size. The size must be greater than 0.
func (*Buffer) Bytes ¶
Bytes provides a slice of the bytes written. This slice should not be written to.
func (*Buffer) Reset ¶
func (b *Buffer) Reset()
Reset resets the buffer so it has no content.
func (*Buffer) Size ¶
Size returns the size of the buffer
func (*Buffer) String ¶
String returns the contents of the buffer as a string
func (*Buffer) TotalWritten ¶
TotalWritten provides the total number of bytes written
func (*Buffer) Write ¶
Write writes up to len(buf) bytes to the internal ring, overriding older data if necessary.
Source Files ¶
- Version
- v0.0.0-20190214190532-5111143e8da2 (latest)
- Published
- Feb 14, 2019
- Platform
- js/wasm
- Imports
- 1 packages
- Last checked
- now –
Tools for package owners.