MCPcopy Create free account
hub / github.com/segmentio/encoding / Scan

Function Scan

proto/message.go:240–252  ·  view source on GitHub ↗

Scan calls fn for each protobuf field in the message b. The iteration stops when all fields have been scanned, fn returns false, or an error is seen.

(b []byte, fn func(FieldNumber, WireType, RawValue) (bool, error))

Source from the content-addressed store, hash-verified

238// The iteration stops when all fields have been scanned, fn returns false, or
239// an error is seen.
240func Scan(b []byte, fn func(FieldNumber, WireType, RawValue) (bool, error)) error {
241 for len(b) != 0 {
242 f, t, v, m, err := Parse(b)
243 if err != nil {
244 return err
245 }
246 if ok, err := fn(f, t, v); !ok {
247 return err
248 }
249 b = m
250 }
251 return nil
252}
253
254// RawValue represents a single protobuf value.
255//

Callers 1

BenchmarkScanFunction · 0.85

Calls 1

ParseFunction · 0.70

Tested by 1

BenchmarkScanFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…