mirror of
https://github.com/apple/swift-nio
synced 2026-11-28 05:14:23 +00:00
Fix warnings: private setters cannot be referenced from an '@inlinable' function (#3719)
Fix the following warnings: > setter for property 'xxx' is private and cannot be referenced from an '@inlinable' function; this will be an error in a future Swift language mode
This commit is contained in:
1 parent
14059d6536
commit
e8e0774c1a
7 files changed
+159
-122
No files matched your search
@@ -194,12 +194,18 @@ public final class NIOSingleStepByteToMessageProcessor<Decoder: NIOSingleStepByt
|
||||
case last
|
||||
}
|
||||
|
||||
/// - Note: Must only be modified by `NIOSingleStepByteToMessageProcessor` itself, use ``decoder`` to read it.
|
||||
@usableFromInline
|
||||
internal private(set) var decoder: Decoder
|
||||
internal var _decoder: Decoder
|
||||
|
||||
@inlinable
|
||||
internal var decoder: Decoder {
|
||||
self._decoder
|
||||
}
|
||||
@usableFromInline
|
||||
let maximumBufferSize: Int?
|
||||
@usableFromInline
|
||||
internal private(set) var _buffer: ByteBuffer?
|
||||
internal var _buffer: ByteBuffer?
|
||||
|
||||
/// Initialize a `NIOSingleStepByteToMessageProcessor`.
|
||||
///
|
||||
@@ -209,7 +215,7 @@ public final class NIOSingleStepByteToMessageProcessor<Decoder: NIOSingleStepByt
|
||||
/// An error will be thrown if after decoding elements there is more aggregated data than this amount.
|
||||
@inlinable
|
||||
public init(_ decoder: Decoder, maximumBufferSize: Int? = nil) {
|
||||
self.decoder = decoder
|
||||
self._decoder = decoder
|
||||
self.maximumBufferSize = maximumBufferSize
|
||||
}
|
||||
|
||||
@@ -250,7 +256,7 @@ public final class NIOSingleStepByteToMessageProcessor<Decoder: NIOSingleStepByt
|
||||
// we want to call decodeLast once with an empty buffer if we have nothing
|
||||
if decodeMode == .last && (self._buffer == nil || self._buffer!.readableBytes == 0) {
|
||||
var emptyBuffer = self._buffer ?? ByteBuffer()
|
||||
if let message = try self.decoder.decodeLast(buffer: &emptyBuffer, seenEOF: seenEOF) {
|
||||
if let message = try self._decoder.decodeLast(buffer: &emptyBuffer, seenEOF: seenEOF) {
|
||||
try messageReceiver(message)
|
||||
}
|
||||
return
|
||||
@@ -261,9 +267,9 @@ public final class NIOSingleStepByteToMessageProcessor<Decoder: NIOSingleStepByt
|
||||
|
||||
func decodeOnce(buffer: inout ByteBuffer) throws -> Decoder.InboundOut? {
|
||||
if decodeMode == .normal {
|
||||
return try self.decoder.decode(buffer: &buffer)
|
||||
return try self._decoder.decode(buffer: &buffer)
|
||||
} else {
|
||||
return try self.decoder.decodeLast(buffer: &buffer, seenEOF: seenEOF)
|
||||
return try self._decoder.decodeLast(buffer: &buffer, seenEOF: seenEOF)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,7 +316,7 @@ public final class NIOSingleStepByteToMessageProcessor<Decoder: NIOSingleStepByt
|
||||
// we want to call decodeLast once with an empty buffer if we have nothing
|
||||
if decodeMode == .last && (self._buffer == nil || self._buffer!.readableBytes == 0) {
|
||||
var emptyBuffer = self._buffer ?? ByteBuffer()
|
||||
let message = try self.decoder.decodeLast(buffer: &emptyBuffer, seenEOF: seenEOF)
|
||||
let message = try self._decoder.decodeLast(buffer: &emptyBuffer, seenEOF: seenEOF)
|
||||
return (message, true)
|
||||
}
|
||||
|
||||
@@ -320,9 +326,9 @@ public final class NIOSingleStepByteToMessageProcessor<Decoder: NIOSingleStepByt
|
||||
|
||||
func decodeOnce(buffer: inout ByteBuffer) throws -> Decoder.InboundOut? {
|
||||
if decodeMode == .normal {
|
||||
return try self.decoder.decode(buffer: &buffer)
|
||||
return try self._decoder.decode(buffer: &buffer)
|
||||
} else {
|
||||
return try self.decoder.decodeLast(buffer: &buffer, seenEOF: seenEOF)
|
||||
return try self._decoder.decodeLast(buffer: &buffer, seenEOF: seenEOF)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,7 +346,7 @@ public final class NIOSingleStepByteToMessageProcessor<Decoder: NIOSingleStepByt
|
||||
}
|
||||
|
||||
if let readerIndex = self._buffer?.readerIndex, readerIndex > 0,
|
||||
self.decoder.shouldReclaimBytes(buffer: self._buffer!)
|
||||
self._decoder.shouldReclaimBytes(buffer: self._buffer!)
|
||||
{
|
||||
self._buffer!.discardReadBytes()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user