mirror of
https://github.com/apple/swift-collections
synced 2026-11-25 04:37:48 +00:00
[Heap] Clean up description
- Don’t print the type name - Include some information identifying the heap instance
This commit is contained in:
2 files changed
+27
-6
No files matched your search
@@ -12,7 +12,17 @@
|
||||
extension Heap: CustomStringConvertible {
|
||||
/// A textual representation of this instance.
|
||||
public var description: String {
|
||||
"Heap<\(Element.self)>(count: \(count))"
|
||||
"<\(count) item\(count == 1 ? "" : "s") @\(_idString)>"
|
||||
}
|
||||
|
||||
internal var _idString: String {
|
||||
// "<32 items @0x2787abcf>"
|
||||
_storage.withUnsafeBytes {
|
||||
guard let p = $0.baseAddress else {
|
||||
return "nil"
|
||||
}
|
||||
return String(UInt(bitPattern: p), radix: 16)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user