StreamingBodyHandle
pub struct StreamingBodyHandle { /* private fields */ }A low-level interface to a streaming HTTP body.
The interface to this type is very similar to BodyHandle, however it is write-only, and can
only be created as a result of calling
ResponseHandle::send_to_client() or
RequestHandle::send_async_streaming(),
or as part of a CandidateResponse body transformation.
This type implements Write to write to the end of a body. Note that these operations are
unbuffered, unlike the same operations on the higher-level Body type.
A streaming body handle will be automatically aborted if it goes out of scope without calling
finish().
Methods
abandon
View sourceAbandon a streaming body handle, indicating an unsuccessful end of the stream.
Parameters
- self: Self
Returns
append
View sourceAppend another body onto the end of this body.
This operation is performed in amortized constant time, and so should always be preferred to reading an entire body and then writing the same contents to another body.
The other body will no longer be valid after this call.
Examples
let mut streaming_body = response_handle.stream_to_client(BodyHandle::new());streaming_body.append(other_body);Parameters
- self: &mut Self
- other: BodyHandle
as_u32
View sourceunsafe fn as_u32(&self) -> u32Get the underlying representation of the handle.
Safety
This should only be used when calling the raw ABI directly, and care should be taken not to reuse or alias handle values.
Parameters
- self: &Self
Returns
finish
View sourceFinish writing to a streaming body handle.
Parameters
- self: Self
Returns
from_body_handle
View sourceMake a streaming body handle from a non-streaming handle.
This should only be used when calling the raw ABI directly, and care should be taken not to reuse or alias handle values.
Parameters
- body_handle: BodyHandle
Returns
into_u32
View sourcefn into_u32(self) -> u32Turn a handle into its representation without closing the underlying resource.
Safety
This should only be used when calling the raw ABI directly, and care should be taken not to reuse or alias handle values.
Parameters
- self: Self
Returns