Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
ByteBuffer.debugDescription
suitable for structural display (#…
…2495) ### Motivation `CustomDebugStringConvertible `/`debugDescription` name and documentation is confusing and should be changed but it is today expected to be suitable to be used as part of a structured display e.g. to be printed as part of an `Array`s description, a `struct` or `enum` with associated values. Therefore it should have no unpaired parentheses, no unescaped quotes, no top-level commas and no new lines. ### Modifications let `debugDescription` simply contain the same contents as `description`. We can't remove the property or the conformance without breaking API. ### Results `ByteBuffer` has a proper string representation suitable for being displayed in an `Array`, as the property of a `struct` or an associated value of an `enum`. We can add a new property/method once #2475 landed e.g. ```swift extension ByteBuffer { struct PrintFormat { static let hex: Self static let decimal: Self ... } func descriptionWithContents(format: PrintFormat = .hex, maxBytes: Int = 1024) { ... } } ``` Co-authored-by: Franz Busch <[email protected]>
- Loading branch information