mirror of
https://github.com/apple/swift-nio
synced 2026-11-25 04:47:49 +00:00
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>