common

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2022 License: MIT Imports: 1 Imported by: 0

README

common

This module just provides some simple types and constraints that I want to centrally define to keep consistent across multiple modules/packages.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayElement

type ArrayElement[I constraints.Integer, V any] struct {
	Index I
	Value V
}

ArrayElement is a struct to represent a key/value pair for an array-like generic type. Useful for iterators.

type Index

type Index interface {
	constraints.Integer | constraints.Float
}

Index is a type constraint for indices for array-like generic types. Defined here only for convenience and consistency across modules.

type KVPair

type KVPair[K Key, V any] struct {
	Key   K
	Value V
}

KVPair is a struct to represent a key/value pair for a map-like generic type. Useful for iterating maps.

type Key

type Key interface{ comparable }

Key is a type constraint for associative arrays, and generic map types. Defined here only for convenience and consistency across modules.

type SortableKey

type SortableKey interface{ constraints.Ordered }

SortableKey is a type constraint for associative arrays, and generic types based on map, with an ordered quality. Defined here only for convenience and consistency across modules.

Jump to

Keyboard shortcuts

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