deferred

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package deferred provides a simple way to defer a function call in a separate goroutine and allow multiple callers to wait for the result.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

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

Result represents a computation that runs in the background.

func Defer

func Defer[T any](deferFunc func() (T, error)) *Result[T]

Defer starts the provided function in a separate goroutine and returns a handle to the result.

func (*Result[T]) Get

func (d *Result[T]) Get(ctx context.Context) (T, error)

Get blocks until the background process is finished or the context is canceled.

Jump to

Keyboard shortcuts

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