options

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2025 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Overview

Package options provides additional functions for type option.Option that cannot be expressed as methods on the Option type itself.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromPointer

func FromPointer[T any](value *T) Option[T]

FromPointer converts a *T into an Option[T].

func IsNoneOrZero

func IsNoneOrZero[T comparable](o Option[T]) bool

IsNoneOrZero returns whether o is either empty, or contains a zero value.

func Map

func Map[T, U any](o Option[T], mapping func(T) U) Option[U]

Map applies the given function to the value contained in o, if there is one.

func Max added in v1.1.0

func Max[T cmp.Ordered](inputs ...Option[T]) Option[T]

Max returns the largest of its input values, while disregarding None values. If there are no Some values, None is returned.

func Min added in v1.1.0

func Min[T cmp.Ordered](inputs ...Option[T]) Option[T]

Min returns the smallest of its input values, while disregarding None values. If there are no Some values, None is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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