queue

package
v0.0.0-...-a7402c0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: MIT Imports: 6 Imported by: 0

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 {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewArray

func NewArray[T any]() *Array[T]

func (*Array[T]) ClearAndIter

func (a *Array[T]) ClearAndIter() []T

func (*Array[T]) Contains

func (a *Array[T]) Contains(t T) bool

func (*Array[T]) Delete

func (a *Array[T]) Delete(i int)

func (*Array[T]) IsEmpty

func (a *Array[T]) IsEmpty() bool

func (*Array[T]) Iter

func (a *Array[T]) Iter() []T

func (*Array[T]) MarshalJSON

func (a *Array[T]) MarshalJSON() ([]byte, error)

func (*Array[T]) Put

func (a *Array[T]) Put(t ...T)

func (*Array[T]) PutAll

func (a *Array[T]) PutAll(t []T)

func (*Array[T]) RandomTake

func (a *Array[T]) RandomTake() (t T)

func (*Array[T]) Remove

func (a *Array[T]) Remove(t T)

func (*Array[T]) Size

func (a *Array[T]) Size() int

func (*Array[T]) String

func (a *Array[T]) String() string

func (*Array[T]) Take

func (a *Array[T]) Take() (t T, result bool)

func (*Array[T]) UnmarshalJSON

func (a *Array[T]) UnmarshalJSON(b []byte) error

type BlockQueue

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

func NewBlockQueue

func NewBlockQueue[T any]() *BlockQueue[T]

func NewBlockQueueWithCap

func NewBlockQueueWithCap[T any](capacity int) *BlockQueue[T]

func (*BlockQueue[T]) Pop

func (bq *BlockQueue[T]) Pop() any

Pop This is only supported when methods use coroutines todo To be solved: cannot use item (variable of type any) as type T in return statement

func (*BlockQueue[T]) Push

func (bq *BlockQueue[T]) Push(item T)

type Queue

type Queue[T any] interface {
	Push(T)
	Pop() T
}

type Set

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

func NewSet

func NewSet[T any]() *Set[T]

func (*Set[T]) Add

func (s *Set[T]) Add(t T)

func (*Set[T]) Clear

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

func (*Set[T]) Iter

func (s *Set[T]) Iter() (t []T)

Jump to

Keyboard shortcuts

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