sliceidx

package
v0.0.0-...-157c9c8 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SliceIdx

type SliceIdx struct {
	SliceLen int
	MaxIdx   int
	Recycled []int
}

SliceIdx holds the logic for the slice index.

func New

func New(sliceLen int) SliceIdx

New creates a SliceIdx and sets the sliceLen.

func (*SliceIdx) NextIdx

func (si *SliceIdx) NextIdx() (idx int, app bool)

NextIdx gets the next index for the slice and if it requires an append action.

func (*SliceIdx) Recycle

func (si *SliceIdx) Recycle(idx int)

Recycle appends the idx to Recycled.

func (*SliceIdx) SetSliceLen

func (si *SliceIdx) SetSliceLen(newlen int)

SetSliceLen will set the SliceLen to newlen if newlen > SliceLen.

Jump to

Keyboard shortcuts

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