trans

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2025 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package trans implements the functions, types, and interfaces for the module.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pointer

func Pointer[T any](v T) *T

Pointer returns a pointer to value of Code.

func PointerOrZero added in v0.3.0

func PointerOrZero[T any](v any) *T

PointerOrZero attempts to convert the input value to type *T. Returns a pointer to v if v is of type T, returns v directly if it's already *T, otherwise returns a pointer to a zero value of T. Parameters:

v: The value to be converted, of any type.

Returns:

A pointer of type *T pointing to v or a newly allocated zero value.

func Value

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

Value returns the value of the pointer of Code.

func ValueOrZero added in v0.3.0

func ValueOrZero[T any](v any) T

ValueOrZero attempts to convert the input value to the specified generic type. Returns the value if: - input is a non-nil pointer to the target type (*T) - input is a direct value of the target type (T) Otherwise returns the zero value of type T. Parameters:

v: any type input value that needs conversion

Returns:

T value of the target type, or zero value when conversion fails

Types

This section is empty.

Directories

Path Synopsis
Package reflection implements the functions, types, and interfaces for the module.
Package reflection implements the functions, types, and interfaces for the module.

Jump to

Keyboard shortcuts

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