#[non_exhaustive]pub struct StreamingResponse {
pub url: Url,
pub status: StatusCode,
pub headers: HeaderMap,
pub body: BoxStream<'static, Result<Bytes, HttpClientError>>,
}Expand description
An HTTP response whose body arrives as a byte stream.
§Examples
use futures_util::stream;
use http::{HeaderMap, StatusCode};
use millipede_core::http_client::StreamingResponse;
use url::Url;
let response = StreamingResponse::new(
Url::parse("https://example.com/")?,
StatusCode::OK,
HeaderMap::new(),
Box::pin(stream::empty()),
);
assert_eq!(response.status, StatusCode::OK);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.url: UrlFinal URL after redirects.
status: StatusCodeHTTP response status.
headers: HeaderMapHTTP response headers.
body: BoxStream<'static, Result<Bytes, HttpClientError>>Stream of response body chunks.
Implementations§
Source§impl StreamingResponse
impl StreamingResponse
Sourcepub fn new(
url: Url,
status: StatusCode,
headers: HeaderMap,
body: BoxStream<'static, Result<Bytes, HttpClientError>>,
) -> Self
pub fn new( url: Url, status: StatusCode, headers: HeaderMap, body: BoxStream<'static, Result<Bytes, HttpClientError>>, ) -> Self
Creates a streaming response.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for StreamingResponse
impl !Sync for StreamingResponse
impl !UnwindSafe for StreamingResponse
impl Freeze for StreamingResponse
impl Send for StreamingResponse
impl Unpin for StreamingResponse
impl UnsafeUnpin for StreamingResponse
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