Skip to content

You're viewing documentation for a pre-release version. View the latest stable version

Instance Method

read(_:)

Reads the next part of the body, handing its bytes to body as a borrowed Span<UInt8> along with a flag that is true once the body has ended (in which case the span is empty).
func read<R>(_ body: (Span<UInt8>, Bool) async throws -> R) async throws -> R

Discussion

The span is only valid for the duration of body; copy out anything you need to keep.