MCPcopy Create free account
hub / github.com/NV404/gova / Prepend

Function Prepend

state_slice.go:115–125  ·  view source on GitHub ↗

Prepend is the type-safe free-function version.

(s *StateValue[[]T], item T)

Source from the content-addressed store, hash-verified

113
114// Prepend is the type-safe free-function version.
115func Prepend[T any](s *StateValue[[]T], item T) {
116 s.mu.Lock()
117 s.value = append([]T{item}, s.value...)
118 v := s.value
119 s.mu.Unlock()
120
121 s.notifyInternal(v)
122 if s.onStateChange != nil {
123 s.onStateChange()
124 }
125}
126
127// RemoveWhere is the type-safe free-function version.
128func RemoveWhere[T any](s *StateValue[[]T], pred func(T) bool) {

Callers

nothing calls this directly

Calls 1

notifyInternalMethod · 0.80

Tested by

no test coverage detected