options

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2025 License: GPL-3.0, LGPL-3.0 Imports: 0 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 options provides a generic mechanism for defining configuration of arbitrary types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func As

func As[T any](opts ...Option[T]) *T

As applies Options to a zero-value T, which it then returns.

Types

type Func

type Func[T any] func(*T)

A Func converts a function into an Option, using itself as the Configure method.

func (Func[T]) Configure

func (f Func[T]) Configure(t *T)

Configure implements the Option interface.

type Option

type Option[T any] interface {
	Configure(*T)
}

An Option configures values of arbitrary type.

Jump to

Keyboard shortcuts

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