ServicesLen returns the number of keys for services in the State.
()
| 290 | |
| 291 | // ServicesLen returns the number of keys for services in the State. |
| 292 | func (s *State) ServicesLen() int { |
| 293 | length := 0 |
| 294 | s.dependencies.Range(func(key, _ any) bool { |
| 295 | if str, ok := key.(string); ok && strings.HasPrefix(str, s.servicePrefix) { |
| 296 | length++ |
| 297 | } |
| 298 | return true |
| 299 | }) |
| 300 | |
| 301 | return length |
| 302 | } |
| 303 | |
| 304 | // GetService returns a service present in the application's State. |
| 305 | func GetService[T Service](s *State, key string) (T, bool) { |