From a17db441b50f01fb9a52bac27130b1031d1487ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Tue, 25 Feb 2025 21:06:18 +0900 Subject: [PATCH] feat(pbuf): add api KeepAlive --- pbuf/bytes.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pbuf/bytes.go b/pbuf/bytes.go index cecc3b9..fb3ad26 100644 --- a/pbuf/bytes.go +++ b/pbuf/bytes.go @@ -117,3 +117,9 @@ func (b Bytes) Slice(from, to int) Bytes { nb.dat = b.dat[from:to] return nb } + +// KeepAlive marks Bytes value as reachable. +func (b Bytes) KeepAlive() { + _ = b.buf + _ = b.dat +}