pub struct StreamResponse { /* private fields */ }Expand description
Stream response wrapper with chainable methods
Implementations§
Source§impl StreamResponse
impl StreamResponse
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Check if response indicates success (2xx status)
Sourcepub fn is_client_error(&self) -> bool
pub fn is_client_error(&self) -> bool
Check if response indicates client error (4xx status)
Sourcepub fn is_server_error(&self) -> bool
pub fn is_server_error(&self) -> bool
Check if response indicates server error (5xx status)
Sourcepub async fn json_results<T>(self) -> Result<Vec<T>>where
T: DeserializeOwned + Send,
pub async fn json_results<T>(self) -> Result<Vec<T>>where
T: DeserializeOwned + Send,
Convert stream to JSON objects with automatic parsing and timeout
Sourcepub async fn json<T>(self, timeout: Duration) -> Result<Vec<T>>where
T: DeserializeOwned + Send,
pub async fn json<T>(self, timeout: Duration) -> Result<Vec<T>>where
T: DeserializeOwned + Send,
Convert stream to JSON objects with custom timeout
Sourcepub async fn process_lines<F>(self, timeout: Duration, handler: F) -> Result<()>
pub async fn process_lines<F>(self, timeout: Duration, handler: F) -> Result<()>
Process stream in real-time with a handler
Sourcepub async fn process_json<F, T>(
self,
timeout: Duration,
handler: F,
) -> Result<Vec<T>>
pub async fn process_json<F, T>( self, timeout: Duration, handler: F, ) -> Result<Vec<T>>
Process stream with custom JSON processing
Sourcepub async fn collect_text(self) -> Result<String>
pub async fn collect_text(self) -> Result<String>
Collect all stream content as text
Sourcepub async fn collect_text_with_timeout(
self,
timeout: Duration,
) -> Result<String>
pub async fn collect_text_with_timeout( self, timeout: Duration, ) -> Result<String>
Collect stream content with timeout
Sourcepub fn into_inner(self) -> StreamingResponse
pub fn into_inner(self) -> StreamingResponse
Get the underlying modern StreamingResponse
Auto Trait Implementations§
impl Freeze for StreamResponse
impl !RefUnwindSafe for StreamResponse
impl Send for StreamResponse
impl !Sync for StreamResponse
impl Unpin for StreamResponse
impl !UnwindSafe for StreamResponse
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more