Documentation
¶
Index ¶
- Variables
- func AddBack[S ~[]T, T any](s *S, t *T)
- func AddFront[S ~[]T, T any](s *S, t *T)
- func Append[T any](s *[]T) *T
- func AppendPtr[T any](s *[]*T) *T
- func Del[S ~[]T, T any](s *S, f func(t *T) (del bool))
- func DelBack[S ~[]T, T any](s *S, fromIndex int)
- func DelFront[S ~[]T, T any](s *S, beforeIndex int)
- func DelPtr[S ~[]*T, T any](s *S, f func(t *T) (del bool))
- func LoopAddBack[S ~[]T, T any](s *S, t *T)
- func LoopAddFront[S ~[]T, T any](s *S, t *T)
- func Range[T any](s []T) iter.Seq2[int, *T]
- func Resize[S ~[]T, T any](s *S, size int)
- func Search[T any](s []T, okf func(*T) bool) (k int, t *T)
- func Split[S ~[]T, T comparable](s S, sep S, callback func(s S) bool)
- func SplitAfter[S ~[]T, T comparable](s S, sep S, callback func(s S) bool)
- type Buf
- func (t *Buf[T]) AddSize(n int)
- func (t *Buf[T]) Append(data []T) error
- func (t *Buf[T]) AppendTo(to *Buf[T]) error
- func (t *Buf[T]) Appends(f func(ba *BufAppendsI[T])) error
- func (t *Buf[T]) Cap() int
- func (t *Buf[T]) Clear()
- func (t *Buf[T]) ExpandCapTo(size int)
- func (t *Buf[T]) GetCopyBuf() (buf []T)
- func (t *Buf[T]) GetLock() (i interface{ ... })
- func (t *Buf[T]) GetModified() Modified
- func (t *Buf[T]) GetPureBuf() (buf []T)
- func (t *Buf[T]) GetRLock() (i interface{ ... })
- func (t *Buf[T]) GetRawBuf(op, ed int) (buf []T)
- func (t *Buf[T]) HadModified(mt Modified) (modified bool, err error)
- func (t *Buf[T]) IsEmpty() bool
- func (t *Buf[T]) Read(b []T) (n int, e error)
- func (t *Buf[T]) ReadFrom(r interface{ ... }) (total int64, e error)
- func (t *Buf[T]) RemoveBack(n int) error
- func (t *Buf[T]) RemoveFront(n int) error
- func (t *Buf[T]) Reset()
- func (t *Buf[T]) SetFrom(data []T) error
- func (t *Buf[T]) SetModified()
- func (t *Buf[T]) SetSize(n int)
- func (t *Buf[T]) Size() int
- func (t *Buf[T]) Write(b []T) (n int, e error)
- func (t *Buf[T]) WriteTo(w interface{ ... }) (total int64, e error)
- type BufAppendsI
- type BufLockM
- type BufLockMI
- type BufRLockM
- type BufRLockMI
- type Modified
- type SliceIndex
- func (t *SliceIndex[T]) Append(s, e int)
- func (t *SliceIndex[T]) Clear()
- func (t *SliceIndex[T]) Equal(b []T) bool
- func (t *SliceIndex[T]) GetModified() SliceIndexModified
- func (t *SliceIndex[T]) HadModified(mt SliceIndexModified) (modified bool, err error)
- func (t *SliceIndex[T]) IsEmpty() bool
- func (t *SliceIndex[T]) Iter() iter.Seq2[int, T]
- func (t *SliceIndex[T]) Merge(s, e int)
- func (t *SliceIndex[T]) Read(p []T) (n int, err error)
- func (t *SliceIndex[T]) RemoveBack(n int)
- func (t *SliceIndex[T]) RemoveFront(n int)
- func (t *SliceIndex[T]) Reset()
- func (t *SliceIndex[T]) Size() (c int)
- type SliceIndexModified
- type SliceIndexNoLock
- func (t *SliceIndexNoLock[T]) Append(s, e int)
- func (t *SliceIndexNoLock[T]) Clear()
- func (t *SliceIndexNoLock[T]) Equal(b []T) bool
- func (t *SliceIndexNoLock[T]) FiliterAppend(s, e int, f func(*T) (pass bool))
- func (t *SliceIndexNoLock[T]) GetModified() SliceIndexModified
- func (t *SliceIndexNoLock[T]) HadModified(mt SliceIndexModified) (modified bool, err error)
- func (t *SliceIndexNoLock[T]) IsEmpty() bool
- func (t *SliceIndexNoLock[T]) Iter() iter.Seq2[int, T]
- func (t *SliceIndexNoLock[T]) Merge(s, e int)
- func (t *SliceIndexNoLock[T]) Read(p []T) (n int, err error)
- func (t *SliceIndexNoLock[T]) RemoveBack(n int)
- func (t *SliceIndexNoLock[T]) RemoveFront(n int)
- func (t *SliceIndexNoLock[T]) Reset()
- func (t *SliceIndexNoLock[T]) Size() (c int)
- func (t *SliceIndexNoLock[T]) WriteTo(w interface{ ... }) (n int64, err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoSameBuf = errors.New("slices.HadModified.ErrNoSameBuf")
View Source
var ErrNoSameSliceIndex = errors.New("SliceIndex.HadModified.ErrNoSameSliceIndex")
View Source
var ErrOverLen = errors.New("slices.Remove.ErrOverLen")
View Source
var ErrOverMax = errors.New("slices.Append.ErrOverMax")
Functions ¶
func LoopAddBack ¶ added in v0.28.20250901144016
func LoopAddBack[S ~[]T, T any](s *S, t *T)
func LoopAddFront ¶ added in v0.28.20250901144016
func LoopAddFront[S ~[]T, T any](s *S, t *T)
func Split ¶ added in v0.28.20260214003124
func Split[S ~[]T, T comparable](s S, sep S, callback func(s S) bool)
callback return false to break
func SplitAfter ¶ added in v0.28.20260214003124
func SplitAfter[S ~[]T, T comparable](s S, sep S, callback func(s S) bool)
callback return false to break
Types ¶
type Buf ¶ added in v0.21.1
type Buf[T any] struct { // contains filtered or unexported fields }
func New ¶
normally, use GetLock() or GetRLock() in mutil goroutines
or use other export methods without lock
func (*Buf[T]) Appends ¶ added in v0.28.20250711174942
func (t *Buf[T]) Appends(f func(ba *BufAppendsI[T])) error
func (*Buf[T]) ExpandCapTo ¶ added in v0.28.20250514163050
may alloc more mem
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 (*Buf[T]) GetPureBuf ¶ added in v0.21.1
func (t *Buf[T]) GetPureBuf() (buf []T)
unsafe without lock
func (*Buf[T]) GetRLock ¶ added in v0.28.20260210191038
func (t *Buf[T]) GetRLock() (i interface { RUnlock() BufRLockMI[T] })
func (*Buf[T]) HadModified ¶ added in v0.21.1
func (*Buf[T]) RemoveBack ¶ added in v0.21.1
func (*Buf[T]) RemoveFront ¶ added in v0.21.1
type BufAppendsI ¶ added in v0.28.20250711174942
type BufAppendsI[T any] struct { // contains filtered or unexported fields }
func (*BufAppendsI[T]) Append ¶ added in v0.28.20250711174942
func (t *BufAppendsI[T]) Append(data []T) *BufAppendsI[T]
type BufLockMI ¶ added in v0.28.20251015160112
type BufLockMI[T any] interface { Clear() Reset() ExpandCapTo(size int) Write(b []T) (n int, e error) ReadFrom(r interface { Read(p []T) (n int, err error) }) (int64, error) Append(data []T) error Appends(f func(ba *BufAppendsI[T])) error SetFrom(data []T) error RemoveFront(n int) error RemoveBack(n int) error SetModified() SetSize(int) BufRLockMI[T] }
type BufRLockMI ¶ added in v0.28.20260210191038
type BufRLockMI[T any] interface { IsEmpty() bool Size() int Cap() int Read(b []T) (n int, e error) RemoveFront(int) error RemoveBack(int) error AppendTo(to *Buf[T]) error GetCopyBuf() []T GetPureBuf() []T // unsafe GetRawBuf(op, ed int) []T // unsafe GetModified() Modified HadModified(mt Modified) (modified bool, err error) }
type SliceIndex ¶ added in v0.28.20250516172937
type SliceIndex[T comparable] struct { // contains filtered or unexported fields }
func NewSliceIndex ¶ added in v0.28.20250516172937
func NewSliceIndex[T comparable](source []T) *SliceIndex[T]
func (*SliceIndex[T]) Append ¶ added in v0.28.20250516172937
func (t *SliceIndex[T]) Append(s, e int)
func (*SliceIndex[T]) Clear ¶ added in v0.28.20250516172937
func (t *SliceIndex[T]) Clear()
func (*SliceIndex[T]) Equal ¶ added in v0.28.20250516172937
func (t *SliceIndex[T]) Equal(b []T) bool
func (*SliceIndex[T]) GetModified ¶ added in v0.28.20250516172937
func (t *SliceIndex[T]) GetModified() SliceIndexModified
func (*SliceIndex[T]) HadModified ¶ added in v0.28.20250516172937
func (t *SliceIndex[T]) HadModified(mt SliceIndexModified) (modified bool, err error)
func (*SliceIndex[T]) IsEmpty ¶ added in v0.28.20250516172937
func (t *SliceIndex[T]) IsEmpty() bool
func (*SliceIndex[T]) Iter ¶ added in v0.28.20250516172937
func (t *SliceIndex[T]) Iter() iter.Seq2[int, T]
func (*SliceIndex[T]) Merge ¶ added in v0.28.20250516172937
func (t *SliceIndex[T]) Merge(s, e int)
func (*SliceIndex[T]) Read ¶ added in v0.28.20250516172937
func (t *SliceIndex[T]) Read(p []T) (n int, err error)
func (*SliceIndex[T]) RemoveBack ¶ added in v0.28.20250516172937
func (t *SliceIndex[T]) RemoveBack(n int)
func (*SliceIndex[T]) RemoveFront ¶ added in v0.28.20250516172937
func (t *SliceIndex[T]) RemoveFront(n int)
func (*SliceIndex[T]) Reset ¶ added in v0.28.20250516172937
func (t *SliceIndex[T]) Reset()
func (*SliceIndex[T]) Size ¶ added in v0.28.20250516172937
func (t *SliceIndex[T]) Size() (c int)
type SliceIndexModified ¶ added in v0.28.20250516172937
type SliceIndexModified struct {
// contains filtered or unexported fields
}
type SliceIndexNoLock ¶ added in v0.28.20250516172937
type SliceIndexNoLock[T comparable] struct { // contains filtered or unexported fields }
func NewSliceIndexNoLock ¶ added in v0.28.20250516172937
func NewSliceIndexNoLock[T comparable](source []T) *SliceIndexNoLock[T]
通过buf类似的操作方法,在现有buf上创建引用
func (*SliceIndexNoLock[T]) Append ¶ added in v0.28.20250516172937
func (t *SliceIndexNoLock[T]) Append(s, e int)
将source[s,e]附加到可读后
func (*SliceIndexNoLock[T]) Clear ¶ added in v0.28.20250516172937
func (t *SliceIndexNoLock[T]) Clear()
func (*SliceIndexNoLock[T]) Equal ¶ added in v0.28.20250516172937
func (t *SliceIndexNoLock[T]) Equal(b []T) bool
func (*SliceIndexNoLock[T]) FiliterAppend ¶ added in v0.28.20260323003954
func (t *SliceIndexNoLock[T]) FiliterAppend(s, e int, f func(*T) (pass bool))
func (*SliceIndexNoLock[T]) GetModified ¶ added in v0.28.20250516172937
func (t *SliceIndexNoLock[T]) GetModified() SliceIndexModified
func (*SliceIndexNoLock[T]) HadModified ¶ added in v0.28.20250516172937
func (t *SliceIndexNoLock[T]) HadModified(mt SliceIndexModified) (modified bool, err error)
func (*SliceIndexNoLock[T]) IsEmpty ¶ added in v0.28.20250516172937
func (t *SliceIndexNoLock[T]) IsEmpty() bool
func (*SliceIndexNoLock[T]) Iter ¶ added in v0.28.20250516172937
func (t *SliceIndexNoLock[T]) Iter() iter.Seq2[int, T]
func (*SliceIndexNoLock[T]) Merge ¶ added in v0.28.20250516172937
func (t *SliceIndexNoLock[T]) Merge(s, e int)
将source[s,e]合并到可读中
func (*SliceIndexNoLock[T]) Read ¶ added in v0.28.20250516172937
func (t *SliceIndexNoLock[T]) Read(p []T) (n int, err error)
func (*SliceIndexNoLock[T]) RemoveBack ¶ added in v0.28.20250516172937
func (t *SliceIndexNoLock[T]) RemoveBack(n int)
func (*SliceIndexNoLock[T]) RemoveFront ¶ added in v0.28.20250516172937
func (t *SliceIndexNoLock[T]) RemoveFront(n int)
func (*SliceIndexNoLock[T]) Reset ¶ added in v0.28.20250516172937
func (t *SliceIndexNoLock[T]) Reset()
func (*SliceIndexNoLock[T]) Size ¶ added in v0.28.20250516172937
func (t *SliceIndexNoLock[T]) Size() (c int)
Click to show internal directories.
Click to hide internal directories.