runtimex

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2025 License: GPL-3.0 Imports: 2 Imported by: 5

Documentation

Overview

Package runtimex contains runtime extensions.

This package is inspired to https://pkg.go.dev/github.com/m-lab/go/rtx, except that it's simpler.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assert

func Assert(assertion bool, message string)

Assert calls panic if assertion is false. The type passed to panic is an error constructed using errors.New(message).

func PanicOnError

func PanicOnError(err error, message string)

PanicOnError calls panic() if err is not nil. The type passed to panic is an error type wrapping the original error.

func Try0

func Try0(err error)

Try0 calls runtimex.PanicOnError if err is not nil.

func Try1

func Try1[T1 any](v1 T1, err error) T1

Try1 is like Try0 but supports functions returning one values and an error.

func Try2

func Try2[T1, T2 any](v1 T1, v2 T2, err error) (T1, T2)

Try2 is like Try1 but supports functions returning two values and an error.

func Try3

func Try3[T1, T2, T3 any](v1 T1, v2 T2, v3 T3, err error) (T1, T2, T3)

Try3 is like Try2 but supports functions returning three values and an error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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