package slab

import "github.com/diamondburned/gotk4/pkg/core/slab"

Index

Types

type Slab

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

Slab is an implementation of the internal registry free list. A zero-value instance is a valid instance. A slab is safe to use concurrently.

func (*Slab) Delete

func (s *Slab) Delete(i uintptr)

Delete removes the entry at the given index.

func (*Slab) Get

func (s *Slab) Get(i uintptr) interface{}

Get gets the entry at the given index.

func (*Slab) Grow

func (s *Slab) Grow(n int)

Grow grows the slab to the given capacity.

func (*Slab) Pop

func (s *Slab) Pop(i uintptr) interface{}

Pop removes the entry at the given index and returns the old value.

func (*Slab) Put

func (s *Slab) Put(entry interface{}, once bool) uintptr

Put stores the entry inside the slab. If once is true, then when the entry is retrieved using Get, it will also be wiped off the list.

Source Files

slab.go

Version
v0.3.1 (latest)
Published
Jul 31, 2024
Platform
linux/amd64
Imports
2 packages
Last checked
1 month ago

Tools for package owners.