unique

package
v1.25.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2025 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

uniqueパッケージは、比較可能な値を正規化(「インターン」)するための機能を提供します。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handle

type Handle[T comparable] struct {
	// contains filtered or unexported fields
}

Handleは型Tの値に対するグローバルに一意な識別子です。

2つのハンドルが等しいと比較されるのは、それらのハンドルを生成した2つの値が 等しいと比較される場合に限ります。ハンドル同士の比較は単純で、 通常、元の値同士を比較するよりもはるかに効率的です。

func Make

func Make[T comparable](value T) Handle[T]

Makeは型Tの値に対するグローバルに一意なハンドルを返します。 ハンドル同士が等しいのは、それらを生成した値が等しい場合のみです。 Makeは複数のゴルーチンから同時に安全に使用できます。

func (Handle[T]) Value

func (h Handle[T]) Value() T

Valueは、Handleを生成したT値の浅いコピーを返します。 Valueは複数のゴルーチンから同時に安全に使用できます。

Jump to

Keyboard shortcuts

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