From a931f2c1de8dd49381ce3bf2e279d033f68d8865 Mon Sep 17 00:00:00 2001 From: MOHAMMED WASIM KHAN <108329802+wasim-builds@users.noreply.github.com> Date: Fri, 28 Aug 2026 19:08:09 +0530 Subject: [PATCH] docs: Document that ByteBuffer is a value type (#3676) Fixes #3037 Co-authored-by: Wasim --- Sources/NIOCore/ByteBuffer-core.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sources/NIOCore/ByteBuffer-core.swift b/Sources/NIOCore/ByteBuffer-core.swift index 92d331ee1..4e46fd80d 100644 --- a/Sources/NIOCore/ByteBuffer-core.swift +++ b/Sources/NIOCore/ByteBuffer-core.swift @@ -190,6 +190,11 @@ public struct ByteBufferAllocator: Sendable { /// `ByteBuffer` stores contiguously allocated raw bytes. It is a random and sequential accessible sequence of zero or /// more bytes (octets). /// +/// ### Value Semantics +/// `ByteBuffer` is a value type. The reader and writer indices can always be modified without a +/// copy of the underlying data. Any data modification may need to copy the contents using +/// copy-on-write if there are multiple references to the underlying data storage. +/// /// ### Allocation /// Use `allocator.buffer(capacity: desiredCapacity)` to allocate a new `ByteBuffer`. ///