NIOCore: Implemented all three variants of _failEarlyRangeCheck methods for ByteBufferView (#2226)

* NIOCore: Implemented all three variants of _failEarlyRangeCheck methods for ByteBufferView

* _failEarlyRangeCheck is now no-op
This commit is contained in:
Anish Aggarwal 2022-07-25 22:37:40 +05:30 committed by GitHub
parent b99da5d3fe
commit dd3b25449a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -137,6 +137,16 @@ public struct ByteBufferView: RandomAccessCollection, NIOSendable {
let iterator = self[self.endIndex..<self.endIndex].makeIterator() let iterator = self[self.endIndex..<self.endIndex].makeIterator()
return (iterator, bytesToWrite) return (iterator, bytesToWrite)
} }
// These are implemented as no-ops for performance reasons.
@inlinable
public func _failEarlyRangeCheck(_ index: Index, bounds: Range<Index>) {}
@inlinable
public func _failEarlyRangeCheck(_ index: Index, bounds: ClosedRange<Index>) {}
@inlinable
public func _failEarlyRangeCheck(_ range: Range<Index>, bounds: Range<Index>) {}
} }
extension ByteBufferView: MutableCollection {} extension ByteBufferView: MutableCollection {}