Prepend is the type-safe free-function version.
(s *StateValue[[]T], item T)
| 113 | |
| 114 | // Prepend is the type-safe free-function version. |
| 115 | func 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. |
| 128 | func RemoveWhere[T any](s *StateValue[[]T], pred func(T) bool) { |
nothing calls this directly
no test coverage detected