Keys returns a slice containing all keys present in the State.
()
| 70 | |
| 71 | // Keys returns a slice containing all keys present in the State. |
| 72 | func (s *State) Keys() []string { |
| 73 | // Pre-allocate with estimated capacity to reduce allocations |
| 74 | keys := make([]string, 0, 8) |
| 75 | s.dependencies.Range(func(key, _ any) bool { |
| 76 | keyStr, ok := key.(string) |
| 77 | if !ok { |
| 78 | return true |
| 79 | } |
| 80 | |
| 81 | keys = append(keys, keyStr) |
| 82 | return true |
| 83 | }) |
| 84 | |
| 85 | return keys |
| 86 | } |
| 87 | |
| 88 | // Len returns the number of keys in the State. |
| 89 | func (s *State) Len() int { |