arity

package
v0.0.0-...-f9dd102 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2025 License: Apache-2.0, MIT Imports: 2 Imported by: 0

Documentation

Overview

Package arity is a micro-package for providing the Arity type, which is used to identify whether the number of arguments being provided to an invocation is valid.

Index

Constants

This section is empty.

Variables

View Source
var ErrBadArity = errors.New("arity")

ErrBadArity is an error that is returned when the arity of a function invocation is incorrect.

Functions

This section is empty.

Types

type Arity

type Arity interface {
	Check(n int) error
	// contains filtered or unexported methods
}

Arity is an interface that checks the arity of function invocations.

func Any

func Any() Arity

Any returns an Arity that checks for any number of arguments.

func AtLeast

func AtLeast(n int) Arity

AtLeast returns an Arity that checks for at least a number of arguments.

func AtMost

func AtMost(n int) Arity

AtMost returns an Arity that checks for at most a number of arguments.

func ClosedRange

func ClosedRange(min, max int) Arity

ClosedRange returns an Arity that checks for a range of arguments.

func Exactly

func Exactly(n int) Arity

Exactly returns an Arity that checks for an exact number of arguments.

func None

func None() Arity

None returns an Arity that checks for no arguments.

func OneOf

func OneOf(arities ...int) Arity

OneOf returns an Arity that checks for a set of arguments.

Jump to

Keyboard shortcuts

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