utils

package
v0.0.0-...-01c3d73 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2025 License: BSD-2-Clause-Views Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stack

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

Stack represents a generic LIFO (Last-In-First-Out) stack data structure.

func NewStack

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

NewStack creates a new empty stack.

func (*Stack[T]) Clear

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

Clear removes all items from the stack.

func (*Stack[T]) IsEmpty

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

IsEmpty returns true if the stack has no items.

func (*Stack[T]) Peek

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

Peek returns the top item from the stack without removing it. Returns the zero value of T and false if the stack is empty.

func (*Stack[T]) Pop

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

Pop removes and returns the top item from the stack. Returns the zero value of T and false if the stack is empty.

func (*Stack[T]) Push

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

Push adds an item to the top of the stack.

func (*Stack[T]) Size

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

Size returns the number of items in the stack.

func (*Stack[T]) ToSlice

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

ToSlice returns a slice containing all items in the stack, ordered from bottom to top (oldest to newest).

Directories

Path Synopsis
Package x509util provides X.509 certificate parsing utilities.
Package x509util provides X.509 certificate parsing utilities.

Jump to

Keyboard shortcuts

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