Documentation ¶
Overview ¶
stack package provides stack(FILO) feature apis. note not safety in concurrent operation.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Stack ¶
type Stack[E any] struct { // contains filtered or unexported fields }
Stack struct
func NewStack ¶
Example ¶
// event bus send event as FILO mode eventBus := stack.NewStack[*string]() fmt.Println(eventBus.IsEmpty()) eventBus.Push(conv.ToPtr("Sig No 109")) eventBus.Push(conv.ToPtr("Sig No 282")) fmt.Println(eventBus.Size()) fmt.Println(*eventBus.Pop()) fmt.Println(*eventBus.Pop())
Output: true 2 Sig No 282 Sig No 109
func NewStackSize ¶
Example ¶
// event bus send event as FILO mode eventBus := stack.NewStackSize[*string](10) fmt.Println(eventBus.IsEmpty()) eventBus.Push(conv.ToPtr("Sig No 109")) eventBus.Push(conv.ToPtr("Sig No 282")) fmt.Println(eventBus.Size()) fmt.Println(eventBus.Cap()) fmt.Println(*eventBus.Pop()) fmt.Println(*eventBus.Pop())
Output: true 2 8 Sig No 282 Sig No 109
Click to show internal directories.
Click to hide internal directories.