x

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2022 License: MIT Imports: 2 Imported by: 2

README

X

A collection of functions to write concise code.

Package documentation

Other useful generic functions can be found at:

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assert added in v0.1.3

func Assert(message string, cond bool)

Assert panics with the given message if cond is false.

func Check

func Check(err error)

Check panics if its argument is a non-nil error.

func Check2 added in v1.0.0

func Check2[T any](a T, err error) T

Check2 panics if its second argument is a non-nil error.

func Check3 added in v1.1.0

func Check3[T1, T2 any](a T1, b T2, err error) (T1, T2)

Check3 panics if its third argument is a non-nil error.

func Max added in v0.1.4

func Max[T constraints.Integer](x, y T) T

Max returns the larger of x or y.

func Min added in v0.1.4

func Min[T constraints.Integer](x, y T) T

Min returns the smaller of x or y.

func MultiLines added in v0.1.5

func MultiLines(s string) string

MultiLines formats a multiline raw string, changing:

`
	First line
		Second line
		Third line
`

to:

`First line
	Second line
	Third line`

It is intended to be called like this:

MultiLines(`
	First Line
		Second line
		Third line
`)

func Ptr

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

Ptr returns a pointer to v.

func Reverse

func Reverse[S ~[]E, E any](s S)

Reverse reverses a slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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