forked from TrueCloudLab/frostfs-api-go
[#49] util/proto: Make NestedStructure*
generic
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
849de02bc3
commit
6e92d7d5de
1 changed files with 2 additions and 2 deletions
|
@ -255,7 +255,7 @@ func NestedStructurePrefix(field int64) (prefix uint64, ln int) {
|
|||
return prefix, VarUIntSize(prefix)
|
||||
}
|
||||
|
||||
func NestedStructureMarshal(field int64, buf []byte, v stableMarshaller) int {
|
||||
func NestedStructureMarshal[T stableMarshaller](field int64, buf []byte, v T) int {
|
||||
n := v.StableSize()
|
||||
if n == 0 {
|
||||
return 0
|
||||
|
@ -269,7 +269,7 @@ func NestedStructureMarshal(field int64, buf []byte, v stableMarshaller) int {
|
|||
return offset + n
|
||||
}
|
||||
|
||||
func NestedStructureSize(field int64, v stableMarshaller) (size int) {
|
||||
func NestedStructureSize[T stableMarshaller](field int64, v T) (size int) {
|
||||
n := v.StableSize()
|
||||
if n == 0 {
|
||||
return 0
|
||||
|
|
Loading…
Reference in a new issue