MCPcopy Create free account
hub / github.com/bufbuild/buf / ForEachEnum

Function ForEachEnum

private/bufpkg/bufprotosource/bufprotosource.go:621–633  ·  view source on GitHub ↗

ForEachEnum calls f on each Enum in the given ContainerDescriptor, including nested Enums. Returns error and stops iterating if f returns error. Never returns error unless f returns error.

(f func(Enum) error, containerDescriptor ContainerDescriptor)

Source from the content-addressed store, hash-verified

619// Returns error and stops iterating if f returns error.
620// Never returns error unless f returns error.
621func ForEachEnum(f func(Enum) error, containerDescriptor ContainerDescriptor) error {
622 for _, enum := range containerDescriptor.Enums() {
623 if err := f(enum); err != nil {
624 return err
625 }
626 }
627 for _, message := range containerDescriptor.Messages() {
628 if err := ForEachEnum(f, message); err != nil {
629 return err
630 }
631 }
632 return nil
633}
634
635// ForEachExtension calls f on each extension Field in the given ContainerDescriptor,
636// including nested extensions.

Callers 4

NewLintEnumRuleHandlerFunction · 0.92
NestedNameToEnumFunction · 0.85
FullNameToEnumFunction · 0.85

Calls 2

EnumsMethod · 0.65
MessagesMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…