stack

package
v0.0.0-...-4b9bf86 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package stack provides a concurrency-safe stack for interface{} guarded by a sync.Mutex

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stack

type Stack struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Stack implements a concurrency-safe stack for anything (interface{}) guarded by a sync.Mutex

func New

func New(cap int) *Stack

New returns a new empty stack with given initial capacity

func (*Stack) Drop

func (s *Stack) Drop()

Drop pops sth silently off the current stack

func (*Stack) Get

func (s *Stack) Get() []interface{}

Get returns a copy of the current stack

func (*Stack) Init

func (s *Stack) Init(cap int) *Stack

Init returns an empty stack with given initial capacity

func (*Stack) Len

func (s *Stack) Len() int

Len returns the length of the current stack

func (*Stack) Pop

func (s *Stack) Pop() interface{}

Pop sth off the current stack

func (*Stack) Push

func (s *Stack) Push(l interface{})

Push sth onto the current stack

func (*Stack) Top

func (s *Stack) Top() interface{}

Top returns the top of the current stack

Jump to

Keyboard shortcuts

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