Optional
extension Optional where Wrapped == ByteBuffer
-
If
nil
, replaceself
with.some(buffer)
. If non-nil
, writebuffer
‘s readable bytes into theByteBuffer
starting atwriterIndex
.This method will not modify
buffer
, meaning itsreaderIndex
andwriterIndex
stays intact.Declaration
Swift
@discardableResult @inlinable public mutating func setOrWriteImmutableBuffer(_ buffer: ByteBuffer) -> Int
Parameters
buffer
The
ByteBuffer
to write.Return Value
The number of bytes written to this
ByteBuffer
which is equal to the number ofreadableBytes
inbuffer
. -
If
nil
, replaceself
with.some(buffer)
. If non-nil
, writebuffer
‘s readable bytes into theByteBuffer
starting atwriterIndex
.This will move both this
ByteBuffer
’s writer index as well asbuffer
’s reader index by the number of bytes readable inbuffer
.Declaration
Swift
@discardableResult @inlinable public mutating func setOrWriteBuffer(_ buffer: inout ByteBuffer) -> Int
Parameters
buffer
The
ByteBuffer
to write.Return Value
The number of bytes written to this
ByteBuffer
which is equal to the number of bytes read frombuffer
.