internal

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package internal provides utility types for the data package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SparseSlice

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

SparseSlice manages a sparse slice of elements, only allocating enough space to satisfy the current set. It uses a 64-bit int as its mask, and is limited to 64 elements. It performs no range checking, so use wisely

func NewSparseSlice

func NewSparseSlice[T any]() *SparseSlice[T]

NewSparseSlice initializes an empty SparseSlice

func (*SparseSlice[T]) All

func (s *SparseSlice[T]) All() iter.Seq2[int, T]

func (*SparseSlice[T]) Contains

func (s *SparseSlice[T]) Contains(idx int) bool

func (*SparseSlice[T]) Get

func (s *SparseSlice[T]) Get(idx int) (T, bool)

Get retrieves a value at a specific index, returning false if it’s not set.

func (*SparseSlice[T]) HighIndex

func (s *SparseSlice[T]) HighIndex() int

func (*SparseSlice[T]) IsEmpty

func (s *SparseSlice[T]) IsEmpty() bool

func (*SparseSlice[T]) LowIndex

func (s *SparseSlice[T]) LowIndex() int

func (*SparseSlice[T]) RawData

func (s *SparseSlice[T]) RawData() ([]T, uint64)

func (*SparseSlice[T]) Set

func (s *SparseSlice[T]) Set(idx int, value T) *SparseSlice[T]

Set returns a new SparseSlice with the value set at the specified index.

func (*SparseSlice[T]) Unset

func (s *SparseSlice[T]) Unset(idx int) *SparseSlice[T]

Unset returns a new SparseSlice with the specified index possibly removed.

func (*SparseSlice[T]) Values

func (s *SparseSlice[T]) Values() iter.Seq[T]

Jump to

Keyboard shortcuts

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