options

package
v2.0.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0, BSD-3-Clause, Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy[T any](opts []T) []T

Copy should be used any time existing options are copied into a new locally scoped set of options. This is to avoid data races and accidental side effects.

func Expand

func Expand[T any](opts []T, initialPosition, trailCapacity int) []T

Expand should be used any time existing options are copied into a new locally scoped set of options and extra space is required. This is to avoid data accidental side effects and undesired reallocations when appending to the new slice. The initialPosition parameter specifies the position in the new slice where the existing options should be copied to. It's assumed that the new slice will at least have a length of initialPosition + len(opts). The trailCapacity parameter specifies the number of additional options that may be appended to the new slice. The new slice will have a capacity of initialPosition + len(opts) + trailCapacity and a length of initialPosition + len(opts).

Types

This section is empty.

Jump to

Keyboard shortcuts

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