opt

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: MIT Imports: 0 Imported by: 20

Documentation

Overview

Package opt provides utilities for optional types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type T

type T[D any] struct {

	// Specified indicates whether Value can be used.
	Specified bool

	// Value holds the actual value.
	Value D
}

T represents an optional type.

func Unspecified

func Unspecified[D any]() T[D]

Unspecified returns an unspecified value of the generic type.

func V

func V[D any](value D) T[D]

V returns a specified value of the generic type.

Jump to

Keyboard shortcuts

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