From c7813eeae0e1905d0586d43619316639e74880aa Mon Sep 17 00:00:00 2001 From: David Nadoba Date: Mon, 7 Aug 2023 14:20:18 +0100 Subject: [PATCH] Make `ByteBuffer.debugDescription` suitable for structural display --- Sources/NIOCore/ByteBuffer-core.swift | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Sources/NIOCore/ByteBuffer-core.swift b/Sources/NIOCore/ByteBuffer-core.swift index 67b1b3e2f6..affba01a0e 100644 --- a/Sources/NIOCore/ByteBuffer-core.swift +++ b/Sources/NIOCore/ByteBuffer-core.swift @@ -888,17 +888,9 @@ extension ByteBuffer: CustomStringConvertible, CustomDebugStringConvertible { } """ } - - /// A `String` describing this `ByteBuffer` with some portion of the readable bytes dumped too. Example: - /// - /// ByteBuffer { readerIndex: 0, writerIndex: 4, readableBytes: 4, capacity: 512, slice: 256..<768, storage: 0x0000000103001000 (1024 bytes)} - /// readable bytes (max 1k): [ 00 01 02 03 ] - /// - /// The format of the description is not API. - /// - /// - returns: A description of this `ByteBuffer` useful for debugging. + public var debugDescription: String { - return "\(self.description)\nreadable bytes (max 1k): \(self._storage.dumpBytes(slice: self._slice, offset: self.readerIndex, length: min(1024, self.readableBytes)))" + String(describing: self) } }