pub enum StreamingResponse<'a> {
H2(H2StreamingResponse<'a>),
H1(H1StreamingResponse<'a>),
}Expand description
A streaming HTTP response that yields body chunks incrementally.
Wraps either an HTTP/2 or HTTP/1.1 streaming response. The connection is borrowed exclusively while this type exists — no other requests can be sent until the body is fully consumed or the response is dropped.
§Example
ⓘ
let mut stream = client.post("/v1/chat/completions")
.header("content-type", "application/json")
.body(payload)
.send_streaming()
.await?;
assert_eq!(stream.status(), 200);
while let Some(chunk) = stream.next_chunk().await? {
// process each body chunk as it arrives
}Variants§
H2(H2StreamingResponse<'a>)
H1(H1StreamingResponse<'a>)
Implementations§
Auto Trait Implementations§
impl<'a> Freeze for StreamingResponse<'a>
impl<'a> RefUnwindSafe for StreamingResponse<'a>
impl<'a> Send for StreamingResponse<'a>
impl<'a> Sync for StreamingResponse<'a>
impl<'a> Unpin for StreamingResponse<'a>
impl<'a> UnsafeUnpin for StreamingResponse<'a>
impl<'a> !UnwindSafe for StreamingResponse<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more