From 2fae20e5c5dd3ddad2a2b509e3a10b311ae5d1e1 Mon Sep 17 00:00:00 2001 From: Louis Thibault Date: Wed, 13 Jul 2022 21:15:08 +0200 Subject: [PATCH] Update docstring for SingleSegmentArena. --- message.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/message.go b/message.go index 848603e9..a41b9e10 100644 --- a/message.go +++ b/message.go @@ -384,13 +384,15 @@ type Arena interface { Allocate(minsz Size, segs map[SegmentID]*Segment) (SegmentID, []byte, error) } -// SingleSegmentArena is a simple arena comprising an expanding buffer. +// SingleSegmentArena is an Arena implementation that stores message data +// in a continguous slice. Allocation is performed by first allocating a +// new slice and copying existing data. SingleSegment arena does not fail +// unless the caller attempts to access another segment. type SingleSegmentArena []byte -// SingleSegment returns a new arena with an expanding single-segment -// buffer. b can be used to populate the segment for reading or to -// reserve memory of a specific size. A SingleSegment arena does not -// return errors unless you attempt to access another segment. +// SingleSegment constructs a SingleSegmentArena from b. b MAY be nil. +// Callers MAY use b to populate the segment for reading, or to reserve +// memory of a specific size. func SingleSegment(b []byte) *SingleSegmentArena { return (*SingleSegmentArena)(&b) }