array2d

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2022 License: MIT Imports: 0 Imported by: 3

README

PkgGoDev License Go Version Tag

CI Go Report Card Maintainability Test Coverage Issues

array2d

Generic 2D array

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array[T any] struct {
	// contains filtered or unexported fields
}

Array is a generic 2D array.

func New

func New[T any](w, h int) (a Array[T])

New creates empty array with given dimensions.

func (Array[T]) Bounds

func (a Array[T]) Bounds() (w, h int)

Bounds returns width and height of array.

func (*Array[T]) Fill

func (a *Array[T]) Fill(fn func() T)

Fill fills array with given function.

func (Array[T]) Get

func (a Array[T]) Get(x, y int) (rv T, ok bool)

Get returns value at given coords, if any.

func (*Array[T]) Iter

func (a *Array[T]) Iter(it func(x, y int, v T) bool)

Iter iterates over array items.

func (Array[T]) Len

func (a Array[T]) Len() (rv int)

Len returns length of array.

func (*Array[T]) Set

func (a *Array[T]) Set(x, y int, v T) (ok bool)

Set sets value at given coords.

Jump to

Keyboard shortcuts

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