ringbuffer

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

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

Buffer is a simple implementation of a ring/circular buffer.

func NewBuffer

func NewBuffer(size uint) *Buffer

NewBuffer returns a ring buffer of a given size.

func (*Buffer) Len

func (b *Buffer) Len() int

func (*Buffer) Read

func (b *Buffer) Read(p []byte) (int, error)

Read reads from the buffer, returning io.EOF if it has read up until where it has written.

func (*Buffer) Write

func (b *Buffer) Write(p []byte) (int, error)

Write writes to the buffer, circularly overwriting data if p exceeds the size of the buffer.

Jump to

Keyboard shortcuts

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