slot

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package slot holds the values of a free-list allocator and marks them live or free, so that checked builds catch a value put back twice, put into another pool, or used after it was put back. With memory_unchecked a Slot holds only its value, is always live, and marking it does nothing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewID

func NewID() uint64

NewID returns a pool id for Mark and Unmark, unique within the process.

func NotLive

func NotLive(pkg string, s any)

NotLive panics, naming the package pkg and the slot s put back while not live in that pool.

func UseAfterPut

func UseAfterPut(pkg string, s any)

UseAfterPut panics, naming the package pkg and the slot s read after Put.

Types

type Slot

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

Slot is a T together with the pool it is live in, if any.

func (*Slot[T]) Live

func (s *Slot[T]) Live() bool

Live reports whether s is live.

func (*Slot[T]) Mark

func (s *Slot[T]) Mark(id uint64)

Mark makes s live in the pool id.

func (*Slot[T]) Unmark

func (s *Slot[T]) Unmark(id uint64) bool

Unmark makes s free in the pool id if it was live there, and reports whether it was.

Jump to

Keyboard shortcuts

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