register

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package register implements a write-once register.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WriteOnce

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

WriteOnce is a concurrent write-once register.

func (*WriteOnce[T]) Read

func (w *WriteOnce[T]) Read() T

Read returns the value of the register, blocking until it is written.

func (*WriteOnce[T]) TryWrite

func (w *WriteOnce[T]) TryWrite(val T) bool

TryWrite tries to write to the register and returns if the write succeeds.

func (*WriteOnce[T]) Write

func (w *WriteOnce[T]) Write(val T)

Write writes to the register, or panics if the register was already written.

Jump to

Keyboard shortcuts

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