pub(crate) fn from_response(
        body: &Bytes,
        headers: &HeaderMap,
    ) -> Result<SnapshotResponse, crate::Error> {
        let etag = match headers.get(header::ETAG) {
            Some(etag) => etag.to_str()?,
            None => {
                static E: header::HeaderName = header::ETAG;
                return Err(crate::Error::MissingHeaderError(E.as_str().to_owned()));
            }
        };

        let last_modified = match headers.get(header::LAST_MODIFIED) {
            Some(last_modified) => last_modified.to_str()?,
            None => {
                static LM: header::HeaderName = header::LAST_MODIFIED;
                return Err(crate::Error::MissingHeaderError(LM.as_str().to_owned()));
            }
        };
        let last_modified = DateTime::parse_from_rfc2822(last_modified)?;

        let request_id = match headers.get(REQUEST_ID) {
            Some(request_id) => request_id.to_str()?,
            None => return Err(crate::Error::MissingHeaderError(REQUEST_ID.to_owned())),
        };

        let date = match headers.get(header::DATE) {
            Some(date) => date.to_str()?,
            None => {
                static D: header::HeaderName = header::DATE;
                return Err(crate::Error::MissingHeaderError(D.as_str().to_owned()));
            }
        };
        let date = DateTime::parse_from_rfc2822(date)?;

        let snapshot = match headers.get(SNAPSHOT) {
            Some(snapshot) => snapshot.to_str()?,
            None => return Err(crate::Error::MissingHeaderError(SNAPSHOT.to_owned())),
        };

        Ok(SnapshotResponse {
            etag: etag.to_owned(),
            last_modified,
            request_id: Uuid::parse_str(request_id)?,
            date,
            snapshot: snapshot.to_owned(),
        })
    }
// this should be named into and be consuming
this should be named into and be consuming
this should be named into and be consuming
pub(crate) fn from_response(
        body: &Bytes,
        headers: &HeaderMap,
    ) -> Result<SnapshotResponse, crate::Error> {
        let etag = match headers.get(header::ETAG) {
            Some(etag) => etag.to_str()?,
            None => {
                static E: header::HeaderName = header::ETAG;
                return Err(crate::Error::MissingHeaderError(E.as_str().to_owned()));
            }
        };
        let last_modified = match headers.get(header::LAST_MODIFIED) {
            Some(last_modified) => last_modified.to_str()?,
            None => {
                static LM: header::HeaderName = header::LAST_MODIFIED;
                return Err(crate::Error::MissingHeaderError(LM.as_str().to_owned()));
            }
        };
        let last_modified = DateTime::parse_from_rfc2822(last_modified)?;
        let request_id = match headers.get(REQUEST_ID) {
            Some(request_id) => request_id.to_str()?,
            None => return Err(crate::Error::MissingHeaderError(REQUEST_ID.to_owned())),
        };
        let date = match headers.get(header::DATE) {
            Some(date) => date.to_str()?,
            None => {
                static D: header::HeaderName = header::DATE;
                return Err(crate::Error::MissingHeaderError(D.as_str().to_owned()));
            }
        };
        let date = DateTime::parse_from_rfc2822(date)?;
        let snapshot = match headers.get(SNAPSHOT) {
            Some(snapshot) => snapshot.to_str()?,
            None => return Err(crate::Error::MissingHeaderError(SNAPSHOT.to_owned())),
        };
        Ok(SnapshotResponse {
            etag: etag.to_owned(),
            last_modified,
            request_id: Uuid::parse_str(request_id)?,
            date,
            snapshot: snapshot.to_owned(),
        })
    }
pub ( crate ) fn from_response ( body : & Bytes , headers : & HeaderMap , ) -> Result < SnapshotResponse , crate :: Error > { let etag = match headers . get ( header :: ETAG ) { Some ( etag ) => etag . to_str ( ) ? , None => { static E : header :: HeaderName = header :: ETAG ; return Err ( crate :: Error :: MissingHeaderError ( E . as_str ( ) . to_owned ( ) ) ) ; } } ; let last_modified = match headers . get ( header :: LAST_MODIFIED ) { Some ( last_modified ) => last_modified . to_str ( ) ? , None => { static LM : header :: HeaderName = header :: LAST_MODIFIED ; return Err ( crate :: Error :: MissingHeaderError ( LM . as_str ( ) . to_owned ( ) ) ) ; } } ; let last_modified = DateTime :: parse_from_rfc2822 ( last_modified ) ? ; let request_id = match headers . get ( REQUEST_ID ) { Some ( request_id ) => request_id . to_str ( ) ? , None => return Err ( crate :: Error :: MissingHeaderError ( REQUEST_ID . to_owned ( ) ) ) , } ; let date = match headers . get ( header :: DATE ) { Some ( date ) => date . to_str ( ) ? , None => { static D : header :: HeaderName = header :: DATE ; return Err ( crate :: Error :: MissingHeaderError ( D . as_str ( ) . to_owned ( ) ) ) ; } } ; let date = DateTime :: parse_from_rfc2822 ( date ) ? ; let snapshot = match headers . get ( SNAPSHOT ) { Some ( snapshot ) => snapshot . to_str ( ) ? , None => return Err ( crate :: Error :: MissingHeaderError ( SNAPSHOT . to_owned ( ) ) ) , } ; Ok ( SnapshotResponse { etag : etag . to_owned ( ) , last_modified , request_id : Uuid :: parse_str ( request_id ) ? , date , snapshot : snapshot . to_owned ( ) , } ) }
this should be named into and be consuming
this should be named into and be consuming
body
&Bytes
headers
&HeaderMap
body
&Bytes
headers
&HeaderMap