[#59] util: Rename stableMarshaler
All checks were successful
DCO action / DCO (pull_request) Successful in 1m23s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m46s
Tests and linters / Lint (pull_request) Successful in 1m59s
Tests and linters / Tests (1.19) (pull_request) Successful in 2m7s
Tests and linters / Tests with -race (pull_request) Successful in 2m22s
All checks were successful
DCO action / DCO (pull_request) Successful in 1m23s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m46s
Tests and linters / Lint (pull_request) Successful in 1m59s
Tests and linters / Tests (1.19) (pull_request) Successful in 2m7s
Tests and linters / Tests with -race (pull_request) Successful in 2m22s
It should be with a single `l`, see `json.Marshaler`. Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
9cc2095446
commit
b46e8cfbda
1 changed files with 4 additions and 4 deletions
|
@ -15,7 +15,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
stableMarshaller interface {
|
stableMarshaler interface {
|
||||||
StableMarshal([]byte) []byte
|
StableMarshal([]byte) []byte
|
||||||
StableSize() int
|
StableSize() int
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ func VarUIntSize(x uint64) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
type ptrStableMarshaler[T any] interface {
|
type ptrStableMarshaler[T any] interface {
|
||||||
stableMarshaller
|
stableMarshaler
|
||||||
~*T
|
~*T
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,7 +268,7 @@ func NestedStructureMarshal[T any, M ptrStableMarshaler[T]](field int64, buf []b
|
||||||
return NestedStructureMarshalUnchecked(field, buf, v)
|
return NestedStructureMarshalUnchecked(field, buf, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NestedStructureMarshalUnchecked[T stableMarshaller](field int64, buf []byte, v T) int {
|
func NestedStructureMarshalUnchecked[T stableMarshaler](field int64, buf []byte, v T) int {
|
||||||
n := v.StableSize()
|
n := v.StableSize()
|
||||||
prefix := protowire.EncodeTag(protowire.Number(field), protowire.BytesType)
|
prefix := protowire.EncodeTag(protowire.Number(field), protowire.BytesType)
|
||||||
offset := binary.PutUvarint(buf, prefix)
|
offset := binary.PutUvarint(buf, prefix)
|
||||||
|
@ -306,7 +306,7 @@ func NestedStructureSize[T any, M ptrStableMarshaler[T]](field int64, v M) (size
|
||||||
return NestedStructureSizeUnchecked(field, v)
|
return NestedStructureSizeUnchecked(field, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NestedStructureSizeUnchecked[T stableMarshaller](field int64, v T) int {
|
func NestedStructureSizeUnchecked[T stableMarshaler](field int64, v T) int {
|
||||||
n := v.StableSize()
|
n := v.StableSize()
|
||||||
return protowire.SizeGroup(protowire.Number(field), protowire.SizeBytes(n))
|
return protowire.SizeGroup(protowire.Number(field), protowire.SizeBytes(n))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue