mirror of
https://github.com/apple/swift-nio
synced 2026-11-22 04:30:41 +00:00
docs: Document that ByteBuffer is a value type (#3676)
Fixes #3037 Co-authored-by: Wasim <wasim@example.com>
This commit is contained in:
1 parent
7800d84cba
commit
a931f2c1de
1 file changed
+5
@@ -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`.
|
||||
///
|
||||
|
||||
Reference in new issue
Block a user