Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Stack ¶ added in v0.6.0
type Stack[T any] interface { // Push adds an element to the stack. Push(v T) // Pop removes and returns the top element of the stack. Pop() T // Peek returns the top element of the stack. Peek() T // Drain removes all elements from the stack and returns them. Drain() []T // Len returns the number of elements in the stack. Len() int }
Stack is a stack data structure.
func NewStack ¶ added in v0.6.0
func NewStack[T any](conf StackConfig) Stack[T]
NewStack returns a new Stack.
type StackConfig ¶ added in v0.6.0
type StackConfig struct {
// ThreadSafe indicates if the stack should be thread safe.
ThreadSafe bool
}
StackConfig holds the configuration for a Stack.
Click to show internal directories.
Click to hide internal directories.