Skip to main content

Module body

Module body 

Source
Expand description

Native HTTP bodies, following Protocol::HTTP::Body.

ReadableBody combines synchronous observations and abandonment with asynchronous frame reads using explicit cancellation. I/O-backed implementations retain explicitly constructed scheduler-bound capabilities.

Body length describes the whole representation. It does not decrease as chunks are consumed, and a HeadBody body may report a nonzero length while emitting no data. Reads move owned BodyFrame events, including trailing fields and completion. An empty data chunk is distinct from completion.

BodyReader and BodyWriter are bounded consumer/producer halves. A protocol driver pulls data directly; bodies do not spawn tasks.

Structs§

BodyReader
The readable half of a bounded, single-producer body.
BodyWriter
The unique output half of a BodyReader body.
BufferedBody
An in-memory, replayable sequence of chunks.
EmptyBody
A ready body with no data and a representation length of zero.
HeadBody
An empty body retaining the representation length for a HEAD response.

Enums§

BodyError
Failures shared by writable bodies and their producers. Failed reports the producer’s error as its source, so callers can downcast it.
BodyFrame
One owned body event. Initial message fields live in the message head; Headers carries trailing fields, after which no more data is permitted.

Traits§

ReadableBody
Protocol-independent body observations and lifecycle.
WritableBody
A body producer accepting owned frames with backpressure. Normal closure preserves accepted frames; failure abandons unfinished output. Flushing exposes accepted frames to the consumer, without promising peer receipt.