Documentation ¶
Overview ¶
Package two provides a 2-tuple type.
Example ¶
package main import ( "fmt" "github.com/phelmkamp/valor/tuple/two" ) func get() (string, int, bool) { return "a", 1, true } func main() { val := two.TupleValueOf(get()) fmt.Println(val) }
Output: {{a 1} true}
Index ¶
- func TupleResultOf[T, T2 any](v T, v2 T2, err error) result.Result[Tuple[T, T2]]
- func TupleUnzip[T, T2, T3, T4 any](t four.Tuple[T, T2, T3, T4]) (Tuple[T, T3], Tuple[T2, T4])
- func TupleValueOf[T, T2 any](v T, v2 T2, ok bool) optional.Value[Tuple[T, T2]]
- func TupleZip[T, T2, T3, T4 any](t Tuple[T, T3], t2 Tuple[T2, T4]) four.Tuple[T, T2, T3, T4]
- type Tuple
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TupleResultOf ¶
TupleResultOf creates a result.Result of either (v, v2) or err. This aids interoperability with function return values.
func TupleUnzip ¶ added in v0.3.0
TupleUnzip separates the values of t into two Tuples.
func TupleValueOf ¶
TupleValueOf creates an optional.Value of (v, v2) if ok is true. This aids interoperability with return values that follow the "comma ok" idiom.
Types ¶
type Tuple ¶
type Tuple[T, T2 any] struct { V T V2 T2 }
Tuple contains two values.
Click to show internal directories.
Click to hide internal directories.