summaryrefslogtreecommitdiffhomepage
path: root/pkg/marshal/marshal.go
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2021-11-05 17:48:53 +0000
committergVisor bot <gvisor-bot@google.com>2021-11-05 17:48:53 +0000
commitf62d5f516175c78eff1857ca938e2c53afb6b7a5 (patch)
tree6203c02fcf397d3a8059f4b2df4d607ca432579e /pkg/marshal/marshal.go
parenta1f6772e7e32a6d8899e5511d226ac7f9b017455 (diff)
parentce4f4283badb6b07baf9f8e6d99e7a5fd15c92db (diff)
Merge release-20211101.0-21-gce4f4283b (automated)
Diffstat (limited to 'pkg/marshal/marshal.go')
-rw-r--r--pkg/marshal/marshal.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/pkg/marshal/marshal.go b/pkg/marshal/marshal.go
index 7da450ce8..9e34eae80 100644
--- a/pkg/marshal/marshal.go
+++ b/pkg/marshal/marshal.go
@@ -59,13 +59,15 @@ type Marshallable interface {
// likely make use of the type of these fields).
SizeBytes() int
- // MarshalBytes serializes a copy of a type to dst.
+ // MarshalBytes serializes a copy of a type to dst and returns the remaining
+ // buffer.
// Precondition: dst must be at least SizeBytes() in length.
- MarshalBytes(dst []byte)
+ MarshalBytes(dst []byte) []byte
- // UnmarshalBytes deserializes a type from src.
+ // UnmarshalBytes deserializes a type from src and returns the remaining
+ // buffer.
// Precondition: src must be at least SizeBytes() in length.
- UnmarshalBytes(src []byte)
+ UnmarshalBytes(src []byte) []byte
// Packed returns true if the marshalled size of the type is the same as the
// size it occupies in memory. This happens when the type has no fields
@@ -86,7 +88,7 @@ type Marshallable interface {
// return false, MarshalUnsafe should fall back to the safer but slower
// MarshalBytes.
// Precondition: dst must be at least SizeBytes() in length.
- MarshalUnsafe(dst []byte)
+ MarshalUnsafe(dst []byte) []byte
// UnmarshalUnsafe deserializes a type by directly copying to the underlying
// memory allocated for the object by the runtime.
@@ -96,7 +98,7 @@ type Marshallable interface {
// UnmarshalUnsafe should fall back to the safer but slower unmarshal
// mechanism implemented in UnmarshalBytes.
// Precondition: src must be at least SizeBytes() in length.
- UnmarshalUnsafe(src []byte)
+ UnmarshalUnsafe(src []byte) []byte
// CopyIn deserializes a Marshallable type from a task's memory. This may
// only be called from a task goroutine. This is more efficient than calling