MCPcopy Create free account
hub / github.com/Monibuca/engine / Push

Method Push

util/list.go:92–102  ·  view source on GitHub ↗
(item *ListItem[T])

Source from the content-addressed store, hash-verified

90}
91
92func (p *List[T]) Push(item *ListItem[T]) {
93 if item.list != nil {
94 panic("item already in list")
95 }
96 if p.Length == 0 {
97 p.Next = &p.ListItem
98 p.Pre = &p.ListItem
99 p.ListItem.list = p
100 }
101 p.Pre.InsertAfter(item)
102}
103
104func (p *List[T]) UnshiftValue(value T) {
105 p.Unshift(&ListItem[T]{Value: value})

Callers 1

PushValueMethod · 0.95

Calls 1

InsertAfterMethod · 0.80

Tested by

no test coverage detected