check

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2024 License: MIT Imports: 2 Imported by: 0

README

check

Go Reference

Refer to documentation at https://pkg.go.dev/github.com/a-jentleman/check

Documentation

Overview

Package check provides utilities for checking the values of variables against common conditions returning specific error types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InRange

func InRange[T cmp.Ordered](actual, min, max T) error

InRange returns an OutOfRangeError if !(min <= actual <= max). InRange panics if max < min or if min or max are NaN.

func Index added in v0.0.2

func Index[I ~int, T any, S ~[]T](index I, slice S) error

Index returns an OutOfRangeError if !(0 <= index < len(slice)).

Types

type OutOfRangeError

type OutOfRangeError string

OutOfRangeError represents an error that occurred when a value was outside an expected range.

func (OutOfRangeError) Error

func (o OutOfRangeError) Error() string

func (OutOfRangeError) Is

func (o OutOfRangeError) Is(err error) bool

Is reports whether err is of type OutOfRangeError in accordance with errors.Is.

Jump to

Keyboard shortcuts

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