Rick Newton-Rogers 4f888611eb
LineBasedFrameDecoder.decodeLast handle more frames (#229)
### Motivation:

`LineBasedFrameDecoder.decodeLast` throws an error if there is more than
one frame’s worth of bytes remaining in the buffer.

This is in violation of the `NIOSingleStepByteToMessageDecoder`protocol
requirement that this method be called in a loop until all bytes are
decoded.

### Modifications:

* The method now only throws if the decode operation could not return a
frame and there are bytes left in the buffer (previously only the latter
criterion applied).
* Method documentation is updated.
* Test added.

### Result:

`LineBasedFrameDecoder.decodeLast` can cope with more edge cases.

Co-authored-by: Rick Newton-Rogers <rnro@apple.com>
2024-09-11 16:44:42 +01:00
2024-09-06 11:57:47 +01:00
2018-05-15 17:09:13 +01:00
2023-04-13 16:47:28 +01:00
2019-10-10 13:51:07 +01:00
2023-06-06 09:10:59 -07:00
2018-05-15 15:36:56 +01:00
2021-03-09 11:10:43 +00:00

NIOExtras

NIOExtras is a good place for code that is related to NIO but not core. It can also be used to incubate APIs for tasks that are possible with core-NIO but are cumbersome today.

What makes a good contribution to NIOExtras?

  • a protocol encoder/decoder pair (also called "codec") that is often used but is small enough so it doesn't need its own repository
  • a helper to achieve a task that is harder-than-necessary to achieve with core-NIO

Code Quality / Stability

All code will go through code review like in the other repositories related to the SwiftNIO project.

swift-nio-extras part of the SwiftNIO 2 family of repositories and depends on the following:

  • swift-nio, version 2.30.0 or better.
  • Swift 5.7.1
  • zlib and its development headers installed on the system. But don't worry, you'll find zlib on pretty much any UNIX system that can compile any sort of code.

To depend on swift-nio-extras, put the following in the dependencies of your Package.swift:

.package(url: "https://github.com/apple/swift-nio-extras.git", from: "1.0.0"),

Support for older Swift versions

The most recent versions of SwiftNIO Extras support Swift 5.7.1 and newer. The minimum Swift version supported by SwiftNIO Extras releases are detailed below:

SwiftNIO Extras Minimum Swift Version
1.0.0 ..< 1.10.0 5.0
1.10.0 ..< 1.11.0 5.2
1.11.0 ..< 1.14.0 5.4
1.14.0 ..< 1.19.0 5.5.2
1.19.0 ..< 1.20.0 5.6
1.20.0 ..< 1.23.0 5.7.1
1.23.0 ... 5.8

On the nio-extras-0.1 branch, you can find the swift-nio-extras version for the SwiftNIO 1 family. It requires Swift 4.1 or better.

Current Contents

Description
Useful code around SwiftNIO.
Readme 1.9 MiB
Languages
Swift 99.8%
C 0.2%