melvin_ob/http_handler/http_response/
shoot_image.rs

1use crate::http_handler::http_response::response_common::{
2    ByteStreamResponseType, HTTPResponseType, ResponseError,
3};
4use futures::StreamExt;
5use prost::bytes::Bytes;
6
7/// Response type for the /image endpoint -> GET
8pub struct ShootImageResponse {}
9
10impl ByteStreamResponseType for ShootImageResponse {}
11
12impl HTTPResponseType for ShootImageResponse {
13    /// Parsed type of the response
14    type ParsedResponseType = futures_core::stream::BoxStream<'static, reqwest::Result<Bytes>>;
15
16    /// Return the deserialized response as a boxed byte stream 
17    async fn read_response(
18        response: reqwest::Response,
19    ) -> Result<Self::ParsedResponseType, ResponseError> {
20        let resp = Self::unwrap_return_code(response).await?;
21        let stream = resp.bytes_stream();
22        Ok(stream.boxed())
23    }
24}