spin

package module
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 4 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

spin

Ring buffer implementation in go

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 the ring buffer implementation.

func New

func New() *Buffer

New creates a new ring buffer.

func (*Buffer) Close

func (b *Buffer) Close() error

Close closes the buffer.

func (*Buffer) Iterate

func (b *Buffer) Iterate(f func(p []byte) (int, bool, error)) (int64, error)

Iterate implements iterator over available data. It makes all the available data to the iterator, then it should say how many bytes has been used and if iterator is interested in receiving more data.

func (*Buffer) Read

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

Read reads bytes from the buffer.

func (*Buffer) ReadByte

func (b *Buffer) ReadByte() (byte, error)

ReadByte reads one byte from the buffer.

func (*Buffer) ReadFrom

func (b *Buffer) ReadFrom(r io.Reader) (int64, error)

ReadFrom copies the content of the provided reader to the ring buffer.

func (*Buffer) Write

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

Write writes bytes to the ring buffer.

func (*Buffer) WriteByte

func (b *Buffer) WriteByte(v byte) error

WriteByte writes one byte to the buffer.

func (*Buffer) WriteTo

func (b *Buffer) WriteTo(w io.Writer) (int64, error)

WriteTo copies the content of the ring buffer to the provided writer.

Jump to

Keyboard shortcuts

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