options

package
v0.7.1-rc.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: GPL-3.0, LGPL-3.0 Imports: 0 Imported by: 0

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