pub struct SharedTrailers { /* private fields */ }Expand description
Shared trailer store populated during body streaming.
Hyper yields trailers as a final Frame::trailers after data frames
(HTTP/1.1 chunked trailers and HTTP/2 trailing HEADERS). The store is
filled exactly once when that frame arrives; it stays None until the
body has advanced far enough, when no trailers were sent, or when a body
error occurred before trailers. It never buffers the body to obtain
trailers and never fabricates trailer state on errors.
Cloning is cheap (Arc); the crate::Response holds one clone while
the body stream holds another, so Response::trailers() remains
available after bytes() collection. Dropping the body early leaves the
store as None and releases the pool permit without waiting for
trailers.
Implementations§
Sourcepub fn get(&self) -> Option<HeaderMap>
pub fn get(&self) -> Option<HeaderMap>
Returns cloned trailers if they have arrived, else None.
None means either the body has not been fully consumed yet, the
response carried no trailers, or a body error occurred before
trailers. Callers must fully consume the body stream (or bytes())
before expecting trailers.