intern

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interner

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

func New

func New(initialCapacity int) *Interner

New creates an interner. initialCapacity is a rough total capacity hint.

func (*Interner) Intern

func (in *Interner) Intern(s string) string

Intern returns the canonical immutable string equal to s. Fast path: read under RLock; on miss, double-check under Lock.

func (*Interner) InternBytes

func (in *Interner) InternBytes(b []byte) string

InternBytes returns the canonical string equal to b. Lookup is zero-alloc (unsafe view); insertion performs exactly one copy to detach from the caller's buffer.

Jump to

Keyboard shortcuts

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