Optional

extension Optional where Wrapped == ByteBuffer

Available where Wrapped == ByteBuffer

  • If nil, replace self with .some(buffer). If non-nil, write buffer‘s readable bytes into the ByteBuffer starting at writerIndex.

    This method will not modify buffer, meaning its readerIndex and writerIndex stays intact.

    Declaration

    Swift

    @discardableResult
    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 of readableBytes in buffer.

  • If nil, replace self with .some(buffer). If non-nil, write buffer‘s readable bytes into the ByteBuffer starting at writerIndex.

    This will move both this ByteBuffer’s writer index as well as buffer’s reader index by the number of bytes readable in buffer.

    Declaration

    Swift

    @discardableResult
    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 from buffer.