withUnsafeBytesOfValue(_:)

Runs body over the raw HTTP field value bytes as a contiguous buffer.

HTTPField.swift:115
func withUnsafeBytesOfValue<Result>(_ body: (UnsafeBufferPointer<UInt8>) throws -> Result) rethrows -> Result

Parameters

body

The closure to be invoked with the buffer.

Returns

Result of the body closure.

This function is useful if the field is not UTF-8 encoded and the default value view cannot be used.

Note that it is unsafe to escape the buffer pointer beyond the duration of this call.