aws-sdk-dataexchange 1.102.0

AWS SDK for AWS Data Exchange
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub(crate) fn de_body_payload(
    body: &[u8],
) -> std::result::Result<::std::option::Option<::std::string::String>, crate::operation::send_api_asset::SendApiAssetError> {
    (!body.is_empty())
        .then(|| {
            let body_str = std::str::from_utf8(body).map_err(crate::operation::send_api_asset::SendApiAssetError::unhandled)?;
            Ok(body_str.to_string())
        })
        .transpose()
}

pub(crate) fn de_response_headers_prefix_header(
    header_map: &::aws_smithy_runtime_api::http::Headers,
) -> std::result::Result<
    ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    ::aws_smithy_http::header::ParseError,
> {
    let headers = ::aws_smithy_http::header::headers_for_prefix(header_map.iter().map(|(k, _)| k), "");
    let out: std::result::Result<_, _> = headers.map(|(key, header_name)| {
                            let values = header_map.get_all(header_name);
                            crate::protocol_serde::shape_send_api_asset_output::de_response_headers_inner(values).map(|v| (key.to_string(), v.expect(
                                "we have checked there is at least one value for this header name; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues"
                            )))
                        }).collect();
    out.map(Some)
}

pub fn de_response_headers_inner<'a>(
    headers: impl ::std::iter::Iterator<Item = &'a str>,
) -> std::result::Result<Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
    ::aws_smithy_http::header::one_or_none(headers)
}