part

package
v0.28.20240522125924 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSameBuf = perrors.New("slices.HadModified", "ErrNoSameBuf")
View Source
var ErrOverLen = perrors.New("slices.Remove", "ErrOverLen")
View Source
var ErrOverMax = perrors.New("slices.Append", "ErrOverMax")
View Source
var ErrOverflow = errors.New("ErrOverflow")

Functions

func AddBack added in v0.28.20240128081851

func AddBack[S ~[]*T, T any](s *S, t *T)

func AddFront added in v0.28.20240128081851

func AddFront[S ~[]*T, T any](s *S, t *T)

func DelBack added in v0.28.20240128081851

func DelBack[S ~[]T, T any](s *S, fromIndex int)

func DelFront added in v0.28.20240128081851

func DelFront[S ~[]T, T any](s *S, beforeIndex int)

Types

type BlocksI added in v0.28.20231214150658

type BlocksI[T any] interface {
	// // eg
	//
	//	if tmpbuf, putBack, e := buf.Get(); e == nil {
	//		clear(tmpbuf)
	//		// do something with tmpbuf
	//		putBack()
	//	}
	Get() ([]T, func(), error)
}

func NewBlocks added in v0.28.20231214142916

func NewBlocks[T any](blockSize int, blockNum int) BlocksI[T]

type Buf added in v0.21.1

type Buf[T any] struct {
	// contains filtered or unexported fields
}

func New

func New[T any](maxsize ...int) *Buf[T]

func (*Buf[T]) Append added in v0.21.1

func (t *Buf[T]) Append(data []T) error

func (*Buf[T]) AppendTo added in v0.28.20240316105420

func (t *Buf[T]) AppendTo(to *Buf[T]) error

func (*Buf[T]) Clear added in v0.21.1

func (t *Buf[T]) Clear()

func (*Buf[T]) GetCopyBuf added in v0.21.1

func (t *Buf[T]) GetCopyBuf() (buf []T)

func (*Buf[T]) GetModified added in v0.21.1

func (t *Buf[T]) GetModified() Modified

func (*Buf[T]) GetPureBuf added in v0.21.1

func (t *Buf[T]) GetPureBuf() (buf []T)

unsafe

func (*Buf[T]) GetPureBufRLock added in v0.28.20240316094927

func (t *Buf[T]) GetPureBufRLock() (buf []T, unlock func())

must call unlock

buf will no modify before unlock

modify func(eg Reset) with block until unlock

unsafe

func (*Buf[T]) HadModified added in v0.21.1

func (t *Buf[T]) HadModified(mt Modified) (modified bool, err error)

func (*Buf[T]) IsEmpty added in v0.21.1

func (t *Buf[T]) IsEmpty() bool

func (*Buf[T]) RemoveBack added in v0.21.1

func (t *Buf[T]) RemoveBack(n int) error

func (*Buf[T]) RemoveFront added in v0.21.1

func (t *Buf[T]) RemoveFront(n int) error

func (*Buf[T]) Reset added in v0.21.1

func (t *Buf[T]) Reset()

func (*Buf[T]) SetFrom added in v0.28.20240330140748

func (t *Buf[T]) SetFrom(data []T) error

func (*Buf[T]) SetModified added in v0.21.1

func (t *Buf[T]) SetModified()

unsafe

func (*Buf[T]) Size added in v0.21.1

func (t *Buf[T]) Size() int

type Modified

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

Jump to

Keyboard shortcuts

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