ringbuffer

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2023 License: MPL-2.0 Imports: 1 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RingBuffer

type RingBuffer struct {
	// contains filtered or unexported fields
}

RingBuffer is a circular buffer that implement io.Writer interface.

func New

func New(size int) *RingBuffer

New returns a new RingBuffer whose buffer has the given size.

func (*RingBuffer) Bytes

func (r *RingBuffer) Bytes() []byte

Bytes returns all available read bytes.

func (*RingBuffer) Capacity

func (r *RingBuffer) Capacity() int

Capacity returns the size of the underlying buffer.

func (*RingBuffer) Reset

func (r *RingBuffer) Reset()

Reset the read pointer and writer pointer to zero.

func (*RingBuffer) Write

func (r *RingBuffer) Write(p []byte) (n int, err error)

Write writes len(p) bytes from p to the underlying buf.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL