pub struct Streaming {
pub headers: Metadata,
/* private fields */
}Expand description
An in-flight response stream.
Backpressure is real and needs no code here: the body replenishes the HTTP/2 receive window only as it is polled, so a consumer that stops reading stops the server rather than filling memory. That is the same guarantee the TypeScript client gets, and for the same reason — it is HTTP/2 doing its job.
Fields§
§headers: MetadataInitial metadata, available as soon as the stream opens.
Implementations§
Source§impl Streaming
impl Streaming
Sourcepub async fn message(&mut self) -> Result<Option<Vec<u8>>, Status>
pub async fn message(&mut self) -> Result<Option<Vec<u8>>, Status>
The next response message, or None once the stream ends.
After None, call Streaming::status for how it ended — a stream that
finishes cleanly still has a status, and it is not always OK.
Sourcepub fn status(&self) -> Status
pub fn status(&self) -> Status
The terminal status. Only meaningful once Streaming::message has
returned None; before that the trailers have not arrived.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Streaming
impl !Send for Streaming
impl !Sync for Streaming
impl !UnwindSafe for Streaming
impl Freeze for Streaming
impl Unpin for Streaming
impl UnsafeUnpin for Streaming
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