Files
swift-nio/Tests
Christian PriebeandJohannes Weiss 03d90a6f2d Add setSubstring/writeSubstring to ByteBuffer. (#1346)
Motivation:

The `ByteBuffer` API currently has `setString`/`writeString` support for the `String`
type but no support for the `Substring` type (see #1332).

Modifications:

Add `setSubstring`/`writeSubstring` functions to `ByteBuffer`. We do not change
the exisiting set-/writeString API to take a generic `StringProtocol` argument
as it would change the ABI and adds performance overhead. We also do not let
`setString` call into `setSubstring` for now, as Substring currently (as of
Swift 5.1.3) has no fast access to the backing storage and this therefore would
introduce a performance regression.

Result:

ByteBuffer API for writing Substrings.

Co-authored-by: Johannes Weiss <johannesweiss@apple.com>
2020-01-22 14:45:40 +00:00
..