core

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrOverflow = errors.New("data overflow")
)

Functions

func WithCapacity added in v0.0.4

func WithCapacity(c int) options.Option[Options]

func WithOverride added in v0.0.4

func WithOverride(o bool) options.Option[Options]

Types

type DataStructureBase

type DataStructureBase interface {
	Size() int
	Empty() bool
	Full() bool
}

DataStructure is the base interface for all data structures.

type Options added in v0.0.4

type Options struct {
	// contains filtered or unexported fields
}

Options is the configuration for data structures (stacks or queues)

func (*Options) Capacity added in v0.0.4

func (o *Options) Capacity() int32

Capacity returns the capacity config, thread safe

func (*Options) Override added in v0.0.4

func (o *Options) Override() bool

type Queue

type Queue[T any] interface {
	Enqueue(T) bool
	Dequeue() (T, bool)

	DataStructureBase
}

Queue is the interface for working with a queue.

type Stack

type Stack[T any] interface {
	Push(T) bool
	Pop() (T, bool)

	DataStructureBase
}

Stack is the interface for working with a stack.

Jump to

Keyboard shortcuts

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