// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. package test import ( binary "encoding/binary" protowire "google.golang.org/protobuf/encoding/protowire" ) import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" // StableSize returns the size of x in protobuf format. // // Structures with the same field values have the same binary size. func (x *Primitives) StableSize() (size int) { if x == nil { return 0 } size += proto.BytesSize(1, x.FieldA) size += proto.StringSize(2, x.FieldB) size += proto.BoolSize(200, x.FieldC) size += proto.Int32Size(201, x.FieldD) size += proto.UInt32Size(202, x.FieldE) size += proto.Int64Size(203, x.FieldF) size += proto.UInt64Size(204, x.FieldG) size += proto.Fixed64Size(205, x.FieldI) size += proto.Float64Size(206, x.FieldJ) size += proto.Fixed32Size(207, x.FieldK) size += proto.EnumSize(300, int32(x.FieldH)) return size } // StableMarshal marshals x in protobuf binary format with stable field order. // // If buffer length is less than x.StableSize(), new buffer is allocated. // // Returns any error encountered which did not allow writing the data completely. // Otherwise, returns the buffer in which the data is written. // // Structures with the same field values have the same binary format. func (x *Primitives) StableMarshal(buf []byte) []byte { if x == nil { return []byte{} } if buf == nil { buf = make([]byte, x.StableSize()) } var offset int offset += proto.BytesMarshal(1, buf[offset:], x.FieldA) offset += proto.StringMarshal(2, buf[offset:], x.FieldB) offset += proto.BoolMarshal(200, buf[offset:], x.FieldC) offset += proto.Int32Marshal(201, buf[offset:], x.FieldD) offset += proto.UInt32Marshal(202, buf[offset:], x.FieldE) offset += proto.Int64Marshal(203, buf[offset:], x.FieldF) offset += proto.UInt64Marshal(204, buf[offset:], x.FieldG) offset += proto.Fixed64Marshal(205, buf[offset:], x.FieldI) offset += proto.Float64Marshal(206, buf[offset:], x.FieldJ) offset += proto.Fixed32Marshal(207, buf[offset:], x.FieldK) offset += proto.EnumMarshal(300, buf[offset:], int32(x.FieldH)) return buf } // StableSize returns the size of x in protobuf format. // // Structures with the same field values have the same binary size. func (x *RepPrimitives) StableSize() (size int) { if x == nil { return 0 } var n int size += proto.RepeatedBytesSize(1, x.FieldA) size += proto.RepeatedStringSize(2, x.FieldB) n, _ = proto.RepeatedInt32Size(3, x.FieldC) size += n n, _ = proto.RepeatedUInt32Size(4, x.FieldD) size += n n, _ = proto.RepeatedInt64Size(5, x.FieldE) size += n n, _ = proto.RepeatedUInt64Size(6, x.FieldF) size += n for i := range x.FieldFu { size += protowire.SizeGroup(protowire.Number(7), protowire.SizeVarint(x.FieldFu[i])) } return size } // StableMarshal marshals x in protobuf binary format with stable field order. // // If buffer length is less than x.StableSize(), new buffer is allocated. // // Returns any error encountered which did not allow writing the data completely. // Otherwise, returns the buffer in which the data is written. // // Structures with the same field values have the same binary format. func (x *RepPrimitives) StableMarshal(buf []byte) []byte { if x == nil { return []byte{} } if buf == nil { buf = make([]byte, x.StableSize()) } var offset int offset += proto.RepeatedBytesMarshal(1, buf[offset:], x.FieldA) offset += proto.RepeatedStringMarshal(2, buf[offset:], x.FieldB) offset += proto.RepeatedInt32Marshal(3, buf[offset:], x.FieldC) offset += proto.RepeatedUInt32Marshal(4, buf[offset:], x.FieldD) offset += proto.RepeatedInt64Marshal(5, buf[offset:], x.FieldE) offset += proto.RepeatedUInt64Marshal(6, buf[offset:], x.FieldF) for i := range x.FieldFu { { prefix := protowire.EncodeTag(protowire.Number(7), protowire.VarintType) offset += binary.PutUvarint(buf[offset:], uint64(prefix)) offset += binary.PutUvarint(buf[offset:], x.FieldFu[i]) } } return buf }