intern

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2022 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package intern maps byte slices into unique symbol identifiers and private copies of those byte slices having the same value.

Byte slices returned by Intern() should not be modified by the caller!

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Symbol

type Symbol int

func Intern

func Intern(b []byte) Symbol

Given a byte slice, return a (symbol, []byte) pair providing the unique symbol number assigned and a copy of the byte slice payload that has been privately recorded by the intern subsystem.

func InternString

func InternString(s string) Symbol

func (Symbol) Bytes

func (s Symbol) Bytes() []byte

Return the byte slice representation of symbol s.

Note that this can have unexpected results if the byte string associated with s is not a valid Unicode string.

func (Symbol) Equals

func (s Symbol) Equals(s2 Symbol) bool

Return true iff symbols s and s2 refer to the same byte slice.

func (Symbol) LessThan

func (s Symbol) LessThan(s2 Symbol) bool

Retrun true iff the byte string denoted by s is bytewise less than the bytestring denoted by s2 according to bytewise lexicographic comparison.

func (Symbol) String

func (s Symbol) String() string

Return the string representation of symbol s.

Note that this can have unexpected results if the byte string associated with s is not a valid Unicode string.

Jump to

Keyboard shortcuts

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