1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub(crate) fn de_checksum_header(
    header_map: &::http::HeaderMap,
) -> std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
    let headers = header_map.get_all("x-amz-checksum").iter();
    ::aws_smithy_http::header::one_or_none(headers)
}

pub(crate) fn de_checksum_algorithm_header(
    header_map: &::http::HeaderMap,
) -> std::result::Result<::std::option::Option<crate::types::DataChecksumAlgorithm>, ::aws_smithy_http::header::ParseError> {
    let headers = header_map.get_all("x-amz-checksum-algorithm").iter();
    ::aws_smithy_http::header::one_or_none(headers)
}

pub fn de_data_payload(
    body: &mut ::aws_smithy_types::body::SdkBody,
) -> std::result::Result<::aws_smithy_types::byte_stream::ByteStream, crate::operation::get_chunk::GetChunkError> {
    // replace the body with an empty body
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
    Ok(::aws_smithy_types::byte_stream::ByteStream::new(body))
}

pub(crate) fn de_length_header(
    header_map: &::http::HeaderMap,
) -> std::result::Result<::std::option::Option<i64>, ::aws_smithy_http::header::ParseError> {
    let headers = header_map.get_all("x-amz-data-length").iter();
    let var_1 = ::aws_smithy_http::header::read_many_primitive::<i64>(headers)?;
    if var_1.len() > 1 {
        Err(::aws_smithy_http::header::ParseError::new(format!(
            "expected one item but found {}",
            var_1.len()
        )))
    } else {
        let mut var_1 = var_1;
        Ok(var_1.pop())
    }
}