ptr

package
v0.0.89 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: CC0-1.0 Imports: 2 Imported by: 0

Documentation

Overview

Package ptr treats pointers as golang's native options.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filter added in v0.0.55

func Filter[T any](tPtr *T, p funcs.Predicate[T]) *T

func FilterNot added in v0.0.55

func FilterNot[T any](t *T, p funcs.Predicate[T]) *T

func FlatMap added in v0.0.63

func FlatMap[T any, R any](t *T, fMapper funcs.Mapper[*T, *R]) *R

func Map added in v0.0.52

func Map[T any, R any](t *T, mapper funcs.Mapper[T, R]) *R

func Nil added in v0.0.52

func Nil[T any]() *T

func None added in v0.0.52

func None[T any]() *T

func Of

func Of[T any](t T) *T

Of is useful when one needs a one-liner for pointer of expression result; one needs to understand, the t will be passed as a copy, and `ptr.Of(x)` will result in pointer to copy of x.

func ToSlice added in v0.0.71

func ToSlice[T any](t *T) []T

ToSlice returns unary slices of optional value, otherwise the empty slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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