cast

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: MIT Imports: 0 Imported by: 8

Documentation

Overview

A simple package to cast between types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsZero

func IsZero[T comparable](v T) bool

IsZero returns true if the given value is the zero value of its type.

func Ptr

func Ptr[T any](val T) *T

Ptr returns a pointer to the value.

func PtrSlice

func PtrSlice[T any](slice ...T) []*T

PtrSlice casts an interface to a slice of pointers.

func String added in v0.1.6

func String[T ~string](val T) string

String is a type that represents a string.

func Value

func Value[T any](val *T) T

Value returns the value of the pointer.

func Zero

func Zero[T any]() T

Zero returns a zero value of the given type.

Types

This section is empty.

Jump to

Keyboard shortcuts

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