ptr

package
v0.0.100 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2025 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

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

func FilterNot

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

func FlatMap

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

func Map

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

func Nil

func Nil[T any]() *T

func None

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

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