pkg

package
v0.0.0-...-e881d30 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FuncEqual

func FuncEqual[F any](a, b F) bool

FuncEqual is a function that check if two functions are equal

func IterAll

func IterAll[T any](i iter.Seq[T]) (items []T)

IterAll returns all items in the iterator.

func MustReadFile

func MustReadFile(filePath string) string

func RecoverFromFunc

func RecoverFromFunc[T any](f func() T) (r T, err error)

RecoverFromFunc is a function that recovers from a function panic

func SliceDelete

func SliceDelete[T comparable](s []T, item T) []T

SliceDelete removes the first occurrence of item from the slice.

func SliceSafeGet

func SliceSafeGet[T any](s []T, index int) (t T)

SliceSafeGet returns the element at the given index in the slice.

Types

type Stack

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

func NewStack

func NewStack[T any]() *Stack[T]

NewStack creates a new stack

func (*Stack[T]) Clear

func (s *Stack[T]) Clear()

func (*Stack[T]) Data

func (s *Stack[T]) Data() []T

func (*Stack[T]) Index

func (s *Stack[T]) Index(i int) T

Index returns the value at the given index

func (*Stack[T]) IsEmpty

func (s *Stack[T]) IsEmpty() bool

IsEmpty checks if the stack is empty

func (*Stack[T]) Len

func (s *Stack[T]) Len() int

Len returns the length of the stack

func (*Stack[T]) Peek

func (s *Stack[T]) Peek() T

Peek at the top value of the stack

func (*Stack[T]) Pop

func (s *Stack[T]) Pop() T

Pop a value from the stack

func (*Stack[T]) Push

func (s *Stack[T]) Push(v T)

Push a value onto the stack

Jump to

Keyboard shortcuts

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