tuple

package
v0.0.0-...-02bf512 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package tuple provides simple tuple implementations

SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Four

type Four[T, U, V, W any] struct {
	T T
	U U
	V V
	W W
}

Four is analogous to Two, but with four values, where the last value might be an error

func Of4

func Of4[T, U, V, W any](t T, u U, v V, w W) Four[T, U, V, W]

func Of4Same

func Of4Same[T any](t T, u T, v T, w T) Four[T, T, T, T]

func (Four[T, U, V, W]) String

func (t Four[T, U, V, W]) String() string

String is the Stringer interface for Four

func (Four[T, U, V, W]) Values

func (t Four[T, U, V, W]) Values() (T, U, V, W)

type Three

type Three[T, U, V any] struct {
	T T
	U U
	V V
}

Three is analogous to Two, but with three values, where the last value might be an error

func Of3

func Of3[T, U, V any](t T, u U, v V) Three[T, U, V]

func Of3Same

func Of3Same[T any](t T, u T, v T) Three[T, T, T]

func (Three[T, U, V]) String

func (t Three[T, U, V]) String() string

String is the Stringer interface for Three

func (Three[T, U, V]) Values

func (t Three[T, U, V]) Values() (T, U, V)

type Two

type Two[T, U any] struct {
	T T
	U U
}

Two is a tuple of two values for cases where it isn't worthwhile to declare your own struct. Particularly useful for functions that need to return (T, error), they can instead return a single value Two[T, error]

func Of2

func Of2[T, U any](t T, u U) Two[T, U]

func Of2Same

func Of2Same[T any](t T, u T) Two[T, T]

func (Two[T, U]) String

func (t Two[T, U]) String() string

String is the Stringer interface for Two

func (Two[T, U]) Values

func (t Two[T, U]) Values() (T, U)

Jump to

Keyboard shortcuts

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