syncext

package
v1.32.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package syncext provides extra functionality on top of the sync package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OnceValue added in v1.32.0

func OnceValue[T any](f func() T) func() T

OnceValue returns a function that invokes f only once and returns the value returned by f. The returned function may be called concurrently.

If f panics, the returned function will panic with the same value on every call.

TODO FUTURE: This is directly copied from 1.21 source, remove when no longer need <1.21.

func OnceValues added in v1.32.0

func OnceValues[T1, T2 any](f func() (T1, T2)) func() (T1, T2)

OnceValues returns a function that invokes f only once and returns the values returned by f. The returned function may be called concurrently.

If f panics, the returned function will panic with the same value on every call.

TODO FUTURE: This is directly copied from 1.21 source, remove when no longer need <1.21.

func OnceValues3

func OnceValues3[T1, T2, T3 any](f func() (T1, T2, T3)) func() (T1, T2, T3)

OnceValues3 returns a function that invokes f only once and returns the values returned by f. The returned function may be called concurrently.

If f panics, the returned function will panic with the same value on every call.

This is copied from sync.OnceValues and extended to for three values.

Types

This section is empty.

Jump to

Keyboard shortcuts

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