typr

package module
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: GPL-3.0 Imports: 0 Imported by: 1

README

typr

The typr package has conventions, type definitions and constants

Documentation

Overview

Package typr contains utility conventions, type definitions and constants

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comparator

type Comparator[V any] func(e1, e2 V) int

returns:

  • 0 if e1 == e2
  • 1 if e1 > e2
  • -1 if e1 < e2

type Op

type Op int

an Operation type value

const (
	Continue Op = iota
	Break
)

type Pair

type Pair[X, Y any] struct {
	X X
	Y Y
}

an envelope holding two values, each respectively of specified type

func (Pair[X, Y]) Value

func (p Pair[X, Y]) Value() (r Pair[X, Y])

returns a copy of the the Pair

type Qualifier

type Qualifier[V any] func(e V) (r bool)

returns bool true, if the specified element e "qualifies", and bool false, otherwise

type Ranger

type Ranger[V any] func(i int, e V) (r Op)

accepts an index and an element of the specified type, and return an Operation value

type Resolver

type Resolver[V, R any] func(v V) (r R)

returns the resolved value (as the specified type), for the specified value

type Trio

type Trio[X, Y, Z any] struct {
	X X
	Y Y
	Z Z
}

an envelope holding three values, each respectively of specified type

func (Trio[X, Y, Z]) Value

func (t Trio[X, Y, Z]) Value() (r Trio[X, Y, Z])

returns a copy of the Trio

type Validator

type Validator[V any] func(e V) (r error)

returns a non-nil error, if the specified element e is considered invalid, and nil, otherwise

Jump to

Keyboard shortcuts

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