Categorygithub.com/ananthb/ringbuffer
repositorypackage
1.0.0
Repository: https://github.com/ananthb/ringbuffer.git
Documentation: pkg.go.dev

# README

ringbuffer

Go Reference CI

A circular buffer (ring buffer) in Go, implementing standard Go interfaces for reads and writes.

Ring Buffer

  rb := New(1024)

  // write
  rb.Write([]byte("abcd"))
  fmt.Println(rb.Length())
  fmt.Println(rb.Free())

  // read
  buf := make([]byte, 4)
  rb.Read(buf)
  fmt.Println(string(buf))

LICENSE

Copyright (c) 2019 smallnest, 2023 Ananth Bhaskararaman

ringbuffer is available under the terms of the MIT license.