Adds min and max, comments, and all of swift's keywords + fix docs (#5737)

This commit is contained in:
mustiikhalil
2020-01-27 21:05:41 +03:00
committed by Wouter van Oortmerssen
parent f2a1272303
commit c580fa284c
6 changed files with 190 additions and 49 deletions

View File

@@ -231,13 +231,14 @@ public final class ByteBuffer {
public func duplicate(removing removeBytes: Int = 0) -> ByteBuffer {
return ByteBuffer(memory: _memory, count: _capacity, removing: _writerSize - removeBytes)
}
#if DEBUG
func debugMemory(str: String) {
let bufprt = UnsafeBufferPointer(start: _memory.assumingMemoryBound(to: UInt8.self),
count: _capacity)
let a = Array(bufprt)
print(str, a, " \nwith buffer size: \(a.count) and writer size: \(_writerSize)")
}
#endif
}
extension ByteBuffer: CustomDebugStringConvertible {
public var debugDescription: String {
"""
buffer located at: \(_memory), with capacity of \(_capacity)
{ writerSize: \(_writerSize), readerSize: \(reader), writerIndex: \(writerIndex) }
"""
}
}