MCPcopy
hub / github.com/grafana/dskit / MarshalToSizedBuffer

Method MarshalToSizedBuffer

httpgrpc/httpgrpc.pb.go:490–531  ·  view source on GitHub ↗
(dAtA []byte)

Source from the content-addressed store, hash-verified

488}
489
490func (m *HTTPRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
491 i := len(dAtA)
492 _ = i
493 var l int
494 _ = l
495 if len(m.Body) > 0 {
496 i -= len(m.Body)
497 copy(dAtA[i:], m.Body)
498 i = encodeVarintHttpgrpc(dAtA, i, uint64(len(m.Body)))
499 i--
500 dAtA[i] = 0x22
501 }
502 if len(m.Headers) > 0 {
503 for iNdEx := len(m.Headers) - 1; iNdEx >= 0; iNdEx-- {
504 {
505 size, err := m.Headers[iNdEx].MarshalToSizedBuffer(dAtA[:i])
506 if err != nil {
507 return 0, err
508 }
509 i -= size
510 i = encodeVarintHttpgrpc(dAtA, i, uint64(size))
511 }
512 i--
513 dAtA[i] = 0x1a
514 }
515 }
516 if len(m.Url) > 0 {
517 i -= len(m.Url)
518 copy(dAtA[i:], m.Url)
519 i = encodeVarintHttpgrpc(dAtA, i, uint64(len(m.Url)))
520 i--
521 dAtA[i] = 0x12
522 }
523 if len(m.Method) > 0 {
524 i -= len(m.Method)
525 copy(dAtA[i:], m.Method)
526 i = encodeVarintHttpgrpc(dAtA, i, uint64(len(m.Method)))
527 i--
528 dAtA[i] = 0xa
529 }
530 return len(dAtA) - i, nil
531}
532
533func (m *HTTPResponse) Marshal() (dAtA []byte, err error) {
534 size := m.Size()

Callers 3

XXX_MarshalMethod · 0.95
MarshalMethod · 0.95
MarshalToMethod · 0.95

Calls 2

encodeVarintHttpgrpcFunction · 0.85
MarshalToSizedBufferMethod · 0.45

Tested by

no test coverage detected